[Lazarus] Loading an integer into a byte array

Hans-Peter Diettrich DrDiettrich1 at aol.com
Thu Jan 8 15:25:00 CET 2009


Dave Coventry schrieb:
> 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:

Which file?

> buffer[0]:=122;
> buffer[1]:=25;
> buffer[2]:=0;
> buffer[3]:=0;

That's the Intel byte order.

> 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?

What is "loading"? Reading from the file?

Otherwise buffer can be a variable of any suitable type, e.g. integer.

DoDi




More information about the Lazarus mailing list