Monday, October 6, 2014

Re: readfile() and writefile() in practice

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On October 6, 2014 11:44:54 PM GMT+03:00, Benjamin Klein <ben@silver-chalice.com> wrote:
>As far as I can tell, readfile() and writefile() have something against
>new lines. If I read a file and then immediately write that (a List) to
>another file, I get all of the first file's contents in a single line
>of the new file.
>
>Is this just something I'm doing wrong? As it is, I apparently can't
>preserve new lines in a file when using these functions.

How can we tell you whether you are doing something wrong if you have not said what are you doing? readfile() is called with one or two arguments, writefile() is called with two or three and you must provide at least all arguments of the latter.

Also note that there were some fixes made to these functions quite a lot time ago, but some distributions still fetch an old version. I do not know any way to achieve the result you claim to be observing with or without those fixes though. How did you test for file being on a single line and what did you see *exactly*? It may have been &fileformat mess for whatever reason.

I can say though that with 'b' second or third argument they work perfectly for copying file contents. Almost never use them without this argument.

>
>Ben
>
>--
>b
>
>Sent from my iPhone

-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1

iQI1BAEBCgAfBQJUMwkRGBxaeVggPHp5eC52aW1AZ21haWwuY29tPgAKCRCf3UKj
HhHSvg8wD/4yn0LPt4q26OdBKMOPsrwOHPjAUoGPFnznZZ5LEAzUh7j+d2o7U4DK
UySoPpkSWYYhUTEL+m12s1bw67bjFsiJ2pnBw+g27jOiy8yOTFUKcGBtw032KCCF
NpFeZqFFNB1CevP3FuY/wivmFRCnEP1h0+O8bQX+8Bwmp2pZarjpOqw3TUgNWBJZ
F/oY9k/sxhH55cTW4KpaCtA+x+tQA5BGYTD9zqL7n95wOld3bGTtS9h7LKUsL/W9
7Sp2XiVZl9yeCUgS5Koul6iAjJhGqle7qOpwj/YrJ3Cwa5SB3cKMv3d+tnTYxMqe
I9Eklka7PYOUF50G++60wb8uZE6HICqH5ah9jzNqxSz2ou/baSj3GcUwgTzRTmJX
mke3ZGq/8ur+GBiQd4+86yWuyCosyL4PKRqcu61wyhoHCh6uP78HnAPPfoSxmso9
32PdJqQvhljKnB1b0NY5J5bt/OrjkjGOLHacnKehnTIWEXFywZ5NlZ/0efdOfml8
45Kc0bJkLy6lPel2CX7Z00N7gd1UrlS4n1N3iVp6MtD247Xtozzo7J418b4rVedG
j/59qbXyc6r+UhmeDTWMyCbJlvLHJh0uNYm6UI1f+lFLMelHFaUTUGMoDVZGAU+4
Yx+RECYWCKfb6lsyFUgyQiA6lbSd2Er3EuQsxW2m/Q0PjXZsvJukmw==
=85xc
-----END PGP SIGNATURE-----

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment