lua-users home
lua-l archive

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


I do some programming with FreeBASIC. In FB, if you open a file in binary access mode, there is a command called "get" which will read a specific number of bytes from the file determined by the data type of the variable passed to it. I.E. with this:

dim as integer a
get #file,,a

FB will read from the file the number of bytes that will fit into FB's integer data type. What I'd like to do is use a lua script to write data to a file so that it can later be retrieved by FB's get, but in my tests I've found that just opening a file as "wb" isn't enough - lua will still write the data as ascii text and using get on the file returns bad numbers. Anyone have any ideas on how to convert numbers before writing it in order to make this work?

For reference, here is the page from the FB wiki that describes the standard data types: http://www.freebasic.net/wiki/wikka.php?wakka=TblVarTypes