Re: [Lazarus] Loading an integer into a byte array

2009-01-09 Thread Bernd Mueller
Duncan Parsons wrote: Must confess, Joost's seemed the most readable, simple and portable :-) but consider NtoLE, if you are dealing mostly with Little Endian machines. Should be faster then. Regards, Bernd. ___ Lazarus mailing list

[Lazarus] Loading an integer into a byte array

2009-01-08 Thread 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

Re: [Lazarus] Loading an integer into a byte array

2009-01-08 Thread Bernd Mueller
Dave Coventry wrote: 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

Re: [Lazarus] Loading an integer into a byte array

2009-01-08 Thread Andrew Brunner
System.Move() On Thu, Jan 8, 2009 at 8:05 AM, Dave Coventry dgcoven...@gmail.com wrote: 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

Re: [Lazarus] Loading an integer into a byte array

2009-01-08 Thread Martin Friebe
Bernd Mueller wrote: Dave Coventry wrote: 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

Re: [Lazarus] Loading an integer into a byte array

2009-01-08 Thread Hans-Peter Diettrich
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

Re: [Lazarus] Loading an integer into a byte array

2009-01-08 Thread Dave Coventry
Thanks DoDi. 2009/1/8 Hans-Peter Diettrich drdiettri...@aol.com: Dave Coventry schrieb: Which file? It's just a data file that I'm writing to. But it does have to be portable to other applications. That's the Intel byte order. Yes, the specification of the datafile require little endian byte

Re: [Lazarus] Loading an integer into a byte array

2009-01-08 Thread Hans-Peter Diettrich
Dave Coventry schrieb: What is loading? Reading from the file? No, the integer value is calculated and must be saved to the file. There is more than one integer in a 48 byte block and I want to write this block to the file, so I'm loading a 48 byte buffer. Some of the values are single bytes