Skip to content
Prev 8508 / 63421 Next

readBin or writeBin adds extra nulls (PR#2333)

Please read the help page:

     `readBin' and `writeBin' read and write C-style zero-terminated
     character strings.  `readChar' and `writeChar' allow more
     flexibility, and can also be used on text-mode connections.

You don't have such character strings in a postscript file (if that is
what foo.ps is).  The code arbitrarily breaks the input into strings of
length 10000 if it gets in trouble finding a null terminator.  The bug is
not issuing a warning to the user if that happens.

You don't get the last part because there was no final null terminator,
so no qualifying string gets read.

You should be using either readChar (as the help page says) if you have a
text file, or integer() of size 1 if you really want to read a file of
bytes.
On Fri, 29 Nov 2002 ken_yap_aus@yahoo.com wrote: