[Gambas-user] BUG in using WRITE #hFILE
Rob
sourceforge-raindog2 at ...94...
Sat Feb 12 19:18:09 CET 2005
On Saturday 12 February 2005 13:09, njmurphy1 at ...734... wrote:
> WRITE #output_file, page_str
> this code produces a file that has 2 or 4 characters of trash
> before the file. I have checked and the trash characters do
> not exists, checking with watch variable or writing to a
> textbox, before the WRITE statement. But if I use PRINT
> instead of WRITE it works just fine. Like this:
> PRINT #output_file, page_str
> I think this is a bug in Gambas. Or am I missing something?
I think you actually mean to be using PRINT, not WRITE. From the
WRITE documentation,
"If Expression is a string, you can specify a length that
indicates the number of bytes to write. If no length is
specified for a string, it is directly written to the stream
just before the string data."
WRITE is meant for writing binary representations of variables
out to files, to be subsequently read using READ. So the
"trash" is actually a binary integer representation of the
length of the string. I'm curious: what led you to choose WRITE
even though PRINT was doing what you wanted it to do?
Rob
More information about the User
mailing list