|
- Forum - iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Sujet n° 1491 |
saving data in files - FILEEXISTS and OPEN doc suggestions |
le 24/11/2006 @ 07:09 par Dave O\'Brien
|
Hi there,
Just changed my Sweeper game to save games to a data file rather than to preferences. Much faster now. Thanks for the tip.
However, it took me 3 hours instead of the 15 minutes I expected, because of three items I didn't fully understand from reading the iziBasic docs:
FILEEXISTS - Wasn't sure if this command needed a fully qualified file name (e.g. "SweeperData.pdb") or just the root name as used by the other file commands (e.g. "SweeperData"). I eventually figured out that it just wanted the root, but this would be a good note to add to the docs under that command (just like it's mentioned for other file commands). No biggie, this one.
{SECUREFILES ON|OFF} - Not sure I understood the docs for this one. If this is ON, does that mean that my code can only write to a file with creatorID = LDIB? Seems like it should allow my own creatorID too. Otherwise, it's very restrictive and perhaps shouldn't default to ON. I eventually turned it off, but still not sure how it works because I finally figured out the last issue (below).
OPEN "foobar" FOR OUTPUT AS #400 - This statement compiles, but does not work. I suspect it's because the number must be 1-255, but the docs omit the allowed range. I initially chose 400 because I wasn't sure if this number would collide with other controls and resources. Once I changed this to #1, everything worked fine. Is it OK to use #1 for a control AND a file?
All's well that ends well, but perhaps a few doc tweaks would save time for the next adventurous soul. ;^)
BTW, this kind of stuff would be good material for a FAQ on the wiki site. Since I'm the one complaining, I'll shut up now and add it. ;^D |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 1 -------- le 24/11/2006 @ 14:01 par aldweb
visiteur |
Hello Dave,
FILEEXISTS PalmOS always uses the root name, the extension ('.pdb' or '.prc', sometimes '.pqa') is never used internally by PalmOS. It is the file type ('appl' for '.prc' and mainly but not exclusively'data' for '.pdb') inside the database storage which defines for PalmOS the type of file. The fully qualified name is only used on a PC to know there what the type of the file is. This seemed so obvious to me because of having worked for years with PalmOS that I never thought about mentionning it somewhere in the user manual.
{SECUREFILES ON|OFF} If ON, then yest with CreatorID = LDIB. If OFF, the main risk is that you can alter and delete any other database in the device, including the Memo, the AddressBook, etc... ones! This directive for sure is very restrictive. I just wanted people to be very aware of the risks they could take. Now, you are right, if ON was set to work with the real CreatorID of the application (or the LDIB one for compatibility reasons), it could be less annoying and not too risky.
OPEN "foobar" FOR OUTPUT AS #400 This #v|n is a dedicated file handle and has nothing to do with objects handle. But maybe you skipped one important information in the user manual. In the introduction paragraph of the Files chapter (page 61), is written: "#v|n is the File Handle and is in the range [0..9]; this means that you can work with up to 10 files simultaneously"
BTW, this kind of stuff would be good material for a FAQ on the wiki site. Since I'm the one complaining, I'll shut up now and add it. ;^D This is a very positive and constructive attitude, thank you.
Cheers, aldweb
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 2 -------- le 24/11/2006 @ 19:51 par Dave O\'Brien
visiteur |
Wiki updated accordingly. Thanks for the info.
Missed the note about file handles. I usually read the docs via a DOC file on my Palm, so I tend to jump directly to the keyword I'm interested in. I'll back up next time and read the overviews too.
SECUREFILES - Yes, I think it would be a good change to allow the program's CreatorID in addition to LDIB files. The danger is really in writing to files with other owners.
Thanks again! |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 3 -------- le 24/11/2006 @ 22:40 par aldweb
visiteur |
I usually read the docs via a DOC file on my Palm
Sure, it's somehow hard to size down the more than 100 pages user manual in a DOC file. It's also hard to get this one sentence even in the original user manual.
I have a good reason for knowing... I wrote it after I developed much more hundreds of pages of code to have iziBasic run
Good job on the wiki Dave. In the name of all readers, thank you. (Many people do not express themselves much here, but there is already a good number of silent readers).
Cheers, aldweb
@+ aldweb |
|
|
sujet actif
sujet clos
Important!
Nouveau message -
Rectifier message
Clôturer sujet
Remonter
|
|