[Rd] readBin or writeBin adds extra nulls (PR#2333)
dmurdoch@pair.com
dmurdoch@pair.com
Fri Nov 29 12:52:03 2002
On Fri, 29 Nov 2002 04:45:46 +0100 (MET), you wrote:
>I'm trying to copy a file using readBin and writeBin. (The reason is to be able
>to pipe PostScript or PDF output to a socket later, this is just an experiment.)
>I do:
>
>zz <- file("foo.ps", "rb")
>r <- readBin(zz, character(), 1000000)
>yy <- file("bar.ps", "wb")
>writeBin(r, yy, character(), 1000000)
>close(yy)
>close(zz)
I see differences between the files too; that looks like a bug. Ken
should have been using readChar and writeChar (the version he was
using breaks at ascii null characters); those appear to work properly.
However, readBin and writeBin should be able to handle very long
strings, or should report an error if they can't.
Duncan Murdoch