On Mon, 6 Mar 2017, fredvs wrote:

Define "much less success". How are you writing the array and how are you
reading it?

Hello and thanks for answer.

Here how the array is written:

var
buffer : array of float;
....
FileBuffer.Data := TFileStream.Create(filename,fmCreate);
FileBuffer.Data.Seek(0, soFromBeginning);
FileBuffer.Data.WriteBuffer(buffer[0],Length(Buffer));

The result is OK if integer 16/32 bit inside the buffer.
If data inside the buffer is float 32 bit, result is a file of... 2
octets...

You must write

 FileBuffer.Data.WriteBuffer(buffer[0],Length(Buffer)*Sizeof(Float));

Because for a dynamic array, length returns the length in elements, not in 
bytes.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to