lua-users home
lua-l archive

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


Hi,

I'm currently programming a little script that need to do byte output to a file, but it's not really doing what I want :)

I need to output specific decimal values, such as 0, but I did not find out how to it. In fact :

outfile = io.open(filename, "r+b")
outfile:write(0)

outputs the character zero, but not a real zero :

[pts/6] -lua/hills skikda% hexdump -C out
00000000  30                                                |0|
00000001

I also tried with string.format :

outfile:write(string.format("%d", 0))

but it's doing exactly the same.

Do you know how I can do this ?

Thanks,
- Sam
--
Maxime Petazzoni - sam@bulix.org - http://www.bulix.org
Gobelins' core team leader       - http://gobelins.nekeme.net
GPG fingerprint: D694 DAB9 8F4E 68A8 4C17  F011 ECAB 0E7B 83E6 AE0D
Jabber: sam@jabber.dk ICQ: 100551837 AIM: maximepetazzoni

Attachment: signature.asc
Description: OpenPGP digital signature