[Gambas-user] text files

nando nando_f at ...951...
Tue Aug 26 19:42:18 CEST 2008


I use WRITE a lot and was confused at the beginning.
There are two different methods...

WRITE #hfile, "Stuff"    'This writes 7 bytes to file <2 Byte length> + 'Stuff'
WRITE #hfile, "Stuff",5  'This writes 5 bytes to file 'Stuff' with nothing extra.

If you do not have the length, then the 2 byte is always prefixed indicating the 
actual length written.

-Fernando

---------- Original Message -----------
From: Rob <sourceforge-raindog2 at ...94...>
To: gambas-user at lists.sourceforge.net
Sent: Tue, 26 Aug 2008 08:48:38 -0400
Subject: Re: [Gambas-user] text files

> On Tuesday 26 August 2008 07:17, Mike wrote:
> > How do I save a text file without extra chars at the start of the file.
> > If I save with the following code there is one extra char added to the
> > start of the file.
> > WRITE #hfile, "Stuff"
> > If I use a very long string I get two chars added at the start of the file.
> 
> "WRITE" writes its arguments in binary format, which includes the length of 
> the string in this case.  You want PRINT.
> 
> Rob
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------





More information about the User mailing list