Clarification of 'INIOPEN' (iPod), please?

Previous topic - Next topic

jaywat

Hi,

I am using INIOPEN to save and load some simple files that hold persistent data. Although not documented as such, I noted in the examples and other code on the forums that using INIOPEN "" after you've done your last INIPUT writes that file to disk, seemingly by calling a 'null file' to open.

However, when I call the save function next, I get the following error in the debug console on opening my file:

fopen("/var/mobile/Applications/<etc>/Documents/file.dat", "rb") failed

and when I next call INIOPEN "" at the end of the function, I get:

request: fopen("", "rb") failed

To clarify, there are two seperate files I am saving to, and I have to assume that they may have made changes and saved to the preferences file before I am next able to call the save file, so I can't just 'leave it open', as such.

I know that I could use OPENFILE and then explicitly call CLOSEFILE, but it seems so, so much easier for my purposes to use INIOPEN because it does all the hard work of formatting it in a readable format. To further clarify, apart from these debug messages, what I'm trying to do works just fine!

1) are these considered 'just for info' messages? And I don't mean just by you guys!  :P  What I mean is, would Apple reject it as a bug?

2) Is there any way round it? Am I ordering something wrong? Is there a way to explicitly TEST if a particular file opened for writing with INIOPEN is *still* open and therefore not make the duplicate call?

Thanks in advance for any wisdom or advice you can impart  :)

Ozden79

I'm using INIOPEN "" in a game in appstore now, though not sure if I get such a warning in it...

MrTAToad

I wonder if "fclose" would be better (if its not used)...

mykyl66

Is there such a command as fclose now??? If so that's a big help as its not mentioned in the help files anywhere.

Cheers

Mike R

jaywat

Quote from: MrTAToad on 2010-Mar-18
I wonder if "fclose" would be better (if its not used)...

As a thought, could I use INLINE to call fclose myself? I've never used INLINE. I don't even know how you would pass the file path you've declared in GLB to an inline statement. But assuming I could, would it make these errors go away? Any reason NOT to do this (iPod specifically speaking!)?

Kitty Hello

Using INIOPEN "" is the right way to close an ini file and save the changes if any. Ignore the output here. I should make that better.
I fixed that output in the next version.
Writing to several ini files is not really supported nicely, ATM, though.