lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Jerome: I still haven't been able to get it compile myself, right now I'm using a version that Shmuel emailed me

Carlos, here's the lua script I'm using to create the test file:


a = struct.pack("BHIL",1,2,3,4)

file ="test.bin","wb")

here is how I'm trying to read the file using FB:

dim a as ubyte
dim b as ushort
dim c as uinteger
dim d as ulongint

open "test.bin" for binary access read as #1
get #1,,a
get #1,,b
get #1,,c
get #1,,d
close #1

print a
print b
print c
print d


this one is the same, only using a UDT instead of individual variables:

type test
   a as ubyte
   b as ushort
   c as uinteger
   d as ulongint
end type

dim t as test
open "test.bin" for binary access read as #1
get #1,,t
close #1

print t.a
print t.b
print t.c
print t.d


note: with the get statement, the second argument is for the position in the file, if you leave it blank like I have here then it will read from the current position in the file

I also tried that test script you posted, and it looks like it's writing/reading the file correctly