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

H.readAll() returning {} when written to it in the exact same program is something else

Started by Famous5000, 21 May 2016 - 01:39 AM
Famous5000 #1
Posted 21 May 2016 - 03:39 AM
Here is the code
http://pastebin.com/ifgypV4A
and the thing it's writing:
This is a test.
The thing it outputs:
{}
Any solutions?
NOTE: Please ignore the P == "No". It's not encrypted due to the fact that I don't care if it's breached or not.
Waitdev_ #2
Posted 21 May 2016 - 03:55 AM
I can't find what line the problem is, but did you do H = fs.open("file","r")? With the "r" ?
Dog #3
Posted 21 May 2016 - 04:08 AM
Well, I noticed on lines 42, 45 and 56 you're using colon notation where you should probably be using dot notation. e.g….

Tr = D.readAll()

Take another look as the fs api (specifically fs.open) and double check all your read and write calls.
Famous5000 #4
Posted 21 May 2016 - 09:07 PM
Well, I noticed on lines 42, 45 and 56 you're using colon notation where you should probably be using dot notation. e.g….

Tr = D.readAll()

Take another look as the fs api (specifically fs.open) and double check all your read and write calls.
I look inside the FS api, and the FS.Open computercraft wiki entries before I posted this. Nothing seemed to help me out.
I've tried using both : and ., with both failing to write.
I can't find what line the problem is, but did you do H = fs.open("file","r")? With the "r" ?
Yes I did.
Edited on 21 May 2016 - 07:08 PM
supernicejohn #5
Posted 21 May 2016 - 09:12 PM
I had this problem when saving an image to file, turns out I was using test:write instead of test.write, so I agree with Dog's comment.
I look inside the FS api, and the FS.Open computercraft wiki entries before I posted this. Nothing seemed to help me out.
I've tried using both : and ., with both failing to write.
Oh. thats weird =/
Edited on 21 May 2016 - 07:15 PM
Dog #6
Posted 21 May 2016 - 09:26 PM
I look inside the FS api, and the FS.Open computercraft wiki entries before I posted this. Nothing seemed to help me out.
I've tried using both : and ., with both failing to write.
Well, if you take a closer look at the wiki you will notice that all the examples use dot notation, not colon notation
Are you sure you changed all your write and read statements to use dot notation? How do you know nothing is being written? Are you viewing the written file directly with edit?
Dragon53535 #7
Posted 21 May 2016 - 09:29 PM
Tutorial
Bomb Bloke #8
Posted 22 May 2016 - 02:03 AM
I've tried using both : and ., with both failing to write.

Dog's still right, though. You're getting "{}" because you incorrectly used colon notation when you wrote that particular file. You need to switch ALL your fs API interactions to dot notation.