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

File Reading?

Started by anidude98, 08 February 2012 - 09:00 PM
anidude98 #1
Posted 08 February 2012 - 10:00 PM
I want to make a simple program that reads files inside a floppy.
It could be used for MANY things including money, locks, adventure maps, and a ton more!
But I haven't found any function that lets me read a file or set a variable as a line of a file. Anyone know what i could do?

I'm currently using labels for this with the disk api… Just to get a simple password type program going…

thanks for any help,
-anidude98
Espen #2
Posted 09 February 2012 - 12:48 AM
Some starting pointers:
In ComputerCraft type: help fs

Read about I/O in LUA:
http://www.lua.org/pil/21.1.html

You can use ComputerCraft's fs.open() instead of LUA's io.open(), but with the latter you can do things like io.read("*a").
Don't know if you can do the latter in same other way with fs.open() as well though. Only know how it works with LUA.

K, hope this sets you on the right path. Have fun exploring! :P/>/>
anidude98 #3
Posted 09 February 2012 - 06:12 AM
Some starting pointers:
In ComputerCraft type: help fs

Read about I/O in LUA:
http://www.lua.org/pil/21.1.html

You can use ComputerCraft's fs.open() instead of LUA's io.open(), but with the latter you can do things like io.read("*a").
Don't know if you can do the latter in same other way with fs.open() as well though. Only know how it works with LUA.

K, hope this sets you on the right path. Have fun exploring! :P/>/>

Actually i found this out on irc, Now im going to learn about hiding information so it cant be read without being decoded. then i can make a real money system for a server… connect all the computers on my server to one computer holding all data for all users… basically a bank program…
Selkitty #4
Posted 09 February 2012 - 06:36 AM
theres a lock program designed that already uses this idea, you should look into it to see how the person reads the file
You can probably get some good ideas as to how to string it together
http://www.computerc...-misc-programs/
anidude98 #5
Posted 09 February 2012 - 06:30 PM
theres a lock program designed that already uses this idea, you should look into it to see how the person reads the file
You can probably get some good ideas as to how to string it together
http://www.computerc...-misc-programs/

are you refering to the reading files from a disk?
or the encoding the files?
Selkitty #6
Posted 10 February 2012 - 05:02 AM
theres a lock program designed that already uses this idea, you should look into it to see how the person reads the file
You can probably get some good ideas as to how to string it together
http://www.computerc...-misc-programs/

are you refering to the reading files from a disk?
or the encoding the files?

this program reads the files on the disk looking for a passcode.
jpzg #7
Posted 31 May 2013 - 04:35 PM
Actually i found this out on irc, Now im going to learn about hiding information so it cant be read without being decoded. then i can make a real money system for a server… connect all the computers on my server to one computer holding all data for all users… basically a bank program…
For encrypting information:
http://www.computercraft.info/forums2/index.php?/topic/6003-cc-146-computercraft-crypto-rev1/page__hl__cryptography__fromsearch__1
Might be useful. Or:
http://www.computercraft.info/forums2/index.php?/topic/12450-killavanillas-various-apis/page__hl__%2Brednet+%2Btunnel__fromsearch__1
Which has AES and some others, as well as a Secure Rednet Tunnel api that might be good for sending data over rednet.
W00dyR #8
Posted 31 May 2013 - 04:49 PM
Snap

Please look at the date of when this was posted. This is well over a year old ;)/>