Posted 12 June 2013 - 04:02 PM
Hello Pros,
I have tried quite a while now to make a more efficient TFileStream implementation in my class library. Compared to a regular stream in any non-Lua file-handling mechanisms, there is a major deficit: I can't seem to open a file for both reading AND writing. If you are not familiar with the idea: normally (i.e. in Windows) files are processed as streams. You open the stream, and then you can navigate using i.e. Seek(Position) to move to a specific byte. Then you use manipulating or non-manipulating methods, like Read() or Write() which affect the selected byte and then move the "cursor" on in the file. It is a very useful option to do it like that, especially if you don't want or don't need to have the whole file in your memory.
So what I of course tried was to open a file capable of reading and writing (io.open("/file", "rw")), so that I don't have to completely store it's contents in a table first. Is that even possible in the ComputerCraft lua environment? Am I missing something here, or not ;)/> ?
Thanks in advance,
KFAFSP
I have tried quite a while now to make a more efficient TFileStream implementation in my class library. Compared to a regular stream in any non-Lua file-handling mechanisms, there is a major deficit: I can't seem to open a file for both reading AND writing. If you are not familiar with the idea: normally (i.e. in Windows) files are processed as streams. You open the stream, and then you can navigate using i.e. Seek(Position) to move to a specific byte. Then you use manipulating or non-manipulating methods, like Read() or Write() which affect the selected byte and then move the "cursor" on in the file. It is a very useful option to do it like that, especially if you don't want or don't need to have the whole file in your memory.
So what I of course tried was to open a file capable of reading and writing (io.open("/file", "rw")), so that I don't have to completely store it's contents in a table first. Is that even possible in the ComputerCraft lua environment? Am I missing something here, or not ;)/> ?
Thanks in advance,
KFAFSP