This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Kingdaro's profile picture

[1.45][SSP] fs.open() behaves weirdly.

Started by Kingdaro, 24 October 2012 - 03:12 AM
Kingdaro #1
Posted 24 October 2012 - 05:12 AM
So I've made a local file on my computer called "colors". I attempt to open it with fs.open(), using a program with "colors" as a given argument, which is passed on to fs.open. It gives me the error "Expected string, string". It doesn't work with "/colors", but it works with "color".

Pretty positive that this is because it checks the rom/programs directory first and returns the error, because these files can't be accessed by local computer programs. Is it supposed to behave this way?
faubiguy #2
Posted 24 October 2012 - 05:18 AM
You need to specify the mode to open with or it will error. So if you want to read "colors", then use
fs.open("colors", "r") -- "r" is read mode

See the wiki page for fs.open.