Monday, October 6, 2014

Re: readfile() and writefile() in practice

On 2014-10-06, Benjamin Klein 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.

I think it's something you're doing wrong.

I just tried the following experiment, where main.c is a six-line
text file I happened to have in my home directory.

$vim -N -u NONE
:let l = readfile("main.c")
:call writefile(l, "main.copy")
:e main.copy

The result looked fine. "diff main.c main.copy" shows the files to
be identical, too.

I'm using vim 7.4.463 on Linux.

Can you show a simple example of what you're doing that isn't
working?

Regards,
Gary

--
--
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: