[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: writing to binary files
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Mon, 21 Apr 2008 10:25:23 -0400
KHMan wrote:
> Merick wrote:
>> Jerome Vuarand wrote:
>>> 2008/4/19, Merick <Merick_TeVaran@comcast.net>:
>>>
>>>> Alright, making some progress here. I've tested the patched dll
>>>> that Shmuel sent me and I've been able to get FB to correctly read
>>>> most of the data written with this, but I'm still having trouble
>>>> with longints. Using this:
>>>>
>>>> a = struct.pack("l",-1)
>>>> print(table.concat({string.byte(a,1,#a)}," "))
>>>>
>>>> the output I get is 255 255 255 255, is this the correct output
>>>> for this?
>>>
>>> As KHMan said, it is correct. What did you expect ?
>>>
>> In freebasic a longint is a signed 64 bit integer
>
> No problem, just do some minor impedance matching. One little
> problem... 64 bit doubles as Lua numbers cannot handle 64 bit ints.
> Does the module has support for 64-bit ints?
I think you can use struct.pack("i8",-1). But as you said you won't be
able to generate the whole range of 64bits integers since Lua numbers
are double (unless you have a custom built Lua version).