You can't read from files in a general sense. There's no general IO library.
It depends on what are you trying to accomplish, though. If you're trying to save data, look into cartdata(). If you want to "flash" the cartridge, look at cstore().
But there's nothing that's the "opposite" of using printh(), which is really meant as a logging utility.
Judging from this and your other thread on keyboard/mouse input, it seems you may be conceiving of PICO-8 as a general purpose computer, when in fact it is really much more of a console (with a gamepad as input) for which you happen to have the editing tools to produce cartridges for end-users. Keeping this in mind may clarify some things for you.
Also, please remember to check the category when posting, as this is your second post in the "Cartridges" category which is not a cartridge. This should be in "Discussion" or "Workshop" or something. Thanks.
If you're feelin' mad there's a couple things you could try. This form talks about using the GPIO pins to communicate with the outside world from a pico 8 card. The github repo is still live so you could figure out how they did it and try something similar.
This thread talks about shoving data into the pico 8 ram on the fly, which, I mean, I guess, if they did it, must be possible. Though they don't have any code to show how, maybe it's the start of a investigation.
But yeah as kittenm4ster says the Pico 8 is a games console, not a computer. So that's worth bearing in mind when dreaming up Pico 8 projects.
EDIT: I only saw the comment re- just wanting save data after writing this - I think it was posted while I was writing this.
Oh, for saving the game check out the Persistent cart data section of memory and start from there.
You want to use cart data:
You don't save to a seperate file you write to the cart itself hence why we were confused! (I've not tried it though!)
[Please log in to post a comment]