Unable to read data file produced using Blitz3D

Blitz3D Forums/Blitz3D Programming/Unable to read data file produced using Blitz3D

andy_mc(Posted 2016) [#1]
I've got a number of data files I produced by simply writing int values to files for levels for a game I wrote using Blitz3D. I can load and save these files no problem using blitz, but when I try to read any of the files using a different programming language (B4A for android in this case), I get rubbish coming out.

Both languages say they read and write 2 bytes at a time for integers but blitz shows one value and the other language shows another. What's going on?


Floyd(Posted 2016) [#2]
Blitz integers are signed, 32-bit, little endian ( intel byte order ).

NOTE: You can WriteShort and ReadShort in Blitz3D. I just did a test, values are 16-bit unsigned. Thus if you WriteShort -1 and ReadShort trying to get it back you will actually get 65535 in Blitz.
You would get -1 in a language that supports signed 16-bit values.


Volturna(Posted 2016) [#3]
Long time ago i had the same problem to read files created in Blitz3D with VB. I solved the problem by converting all the data to string in Blitz and then read it in VB.


andy_mc(Posted 2016) [#4]
turns out the default for the android language was bigEndian, so it works fine now.

thanks for the help guys.