Hi,
After compiling my application on iPod Touch, I am getting an fOpen error on my ini files AFTER the first ini file has been successfully opened and read from.
It's not like I can explicitly close a file, because CLOSEFILE requires a handle defined by OPENFILE.
Besides which, as I understood it, INIOPEN handles closing of files when a new one is called. So can anyone tell me where I'm going wrong or any iPhone specific gotchas?
e.g
request: fopen("Media/lastsave.ini", "rb") failed
wrt-request: fopen("Media/lastsave.ini", "wb") failed
The paths are correct as are the filenames. Its just fails.
Mike R
Don't forget that the location you specified can only be read from and not
written to
Oh? Is there anywhere I can write to an ini file so that I can save game state etc?
Mike R
Maybe this can help. This is how I do it. (obviously, I am writing to the file on quit, but you can write anywhere within your program using this method)
FILE_PATH$ = PLATFORMINFO$("DOCUMENTS")
.
.
.
ok = OPENFILE(1, FILE_PATH$+"/highscore.dat", 1)
IF (ok)
READLONG 1, highscore%
ENDIF
.
.
.
SUB GLB_ON_QUIT:
ok = OPENFILE(1, FILE_PATH$+"/highscore.dat", 0)
IF (ok)
WRITELONG 1,highscore%
CLOSEFILE 1
ENDIF
ENDSUB
It's always best to do something like that for all platforms
Thank you folks. will give it a try right now.
Cheers
Mike R
Just to add, the function (with parameter) PLATFORMINFO$("DOCUMENTS") will return the user's writable app folder.