Is there any way to write files with offset?
For example, I need to write value 01 in #2C5C
All I found was fileSeek function, but it`s not what I am looking for.
Sorry for my bad English and thanks in advance!
Writing to file with Offset. How?
Moderators: Shine, Insert_witty_name
http://luanet.net/lua/function/seek
That doesn't work for you?
Looks to me like you can do:function file:seek ( whence, offset )
Code: Select all
file:seek("set", 0x2C5C)
file:write(0x01)
thank you for helping =)
here is my code
test file before writing (HEX):
00 00 00 00 00 00 00
test file after LUA (HEX):
00 00 00 31
what should I use as an instance of file:write?
thanks again!
here is my code
Code: Select all
file = io.open("test", "wb")
file:seek("set", 0x03)
file:write(0x01)
file:close()
00 00 00 00 00 00 00
test file after LUA (HEX):
00 00 00 31
what should I use as an instance of file:write?
thanks again!
Just to clarify, you're using "wb" which opens a new file (deletes the old one) in binary mode.
http://aaiiee.wordpress.com/
I can no longer do any homebrew PSP development nor discuss PSP specific topics.
I can no longer do any homebrew PSP development nor discuss PSP specific topics.