[Lazarus] Loading an integer into a byte array

Duncan Parsons lazarus at dsparsons.co.uk
Fri Jan 9 02:05:17 CET 2009


Must confess, Joost's seemed the most readable, simple and portable :-)

DSP
Joost van der Sluis wrote:

> Op donderdag 08-01-2009 om 16:05 uur [tijdzone +0200], schreef Dave
> Coventry:
> > I have a file into which I want to put a long integer:
> > 
> > 00 00 19 7A
> > 
> > The file expects the value in the form:
> > 
> > buffer[0]:=122;
> > buffer[1]:=25;
> > buffer[2]:=0;
> > buffer[3]:=0;
> > 
> > I am then intending to write this buffer to the file
> > 
> > FS.Writebuffer(buffer,4);
> > 
> > Is there a way of loading the buffer directly before writing?
> 
> var l : longint;
> 
> l := NtoBE($197a); // Number to BigEndian
> Fs.WriteInt(l);
> 
> I don't have tried it, but it must be something like that?
> 
> Joost.
> 
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus



-- 





More information about the Lazarus mailing list