[Gambas-user] Saving & Loading multible Variables

nando nando_f at ...951...
Wed Jan 11 17:27:50 CET 2006


With strings, there are 2 ways.

1) WRITE #hfile, FirstName, 25   <----writes 25B with padding if needed
2) WRITE #hfile, FirstName       <----write 4B (binary) Length of the string,
                                      then writes the string..ONLY the bytes it
actually is.  This method cannot be used for fixed record sizes

I Use the first method for my Random File Records.

(all this information is listed in Wiki)

-Fernando


---------- Original Message -----------
From: Scott <sclewin at ...1126...>
To: gambas-user at lists.sourceforge.net
Sent: Tue, 10 Jan 2006 16:35:17 -0500
Subject: Re: [Gambas-user] Saving & Loading multible Variables

> nando wrote:
> > Here's how I do multiple variables into 1 file (v 1.0.6)
> >
> >
> > DIM i AS INTEGER
> > DIM s AS STRING
> > DIM q as SHORT
> > DIM hfile AS FILE
> >
> > OPEN "/home/folder1/my_vars/" FOR WRITE AS #hfile
> > WRITE #hfile, i
> > WRITE #hfile, s, 3
> > WRITE #hfile, q
> > CLOSE hfile
> >   
> That is how i ended up doing the multiple variables.  Do you need to 
> put down the string length ("WRITE #hfile, s, *3*") I did not 
> understand that too well.
> 
> -- 
> Your friend,
> Scott
> 
> "Do to others as you would have them do to you."
> Luke 6:31
------- End of Original Message -------





More information about the User mailing list