|Home||Gadgetman||Forum||Book Reviews||Links||Contact me||X-UFO|
|Gadgets||Processors||Programming School||Old news|
There are two ways to implement a .ini file:
IF EXIST (appdisk$+":\System\Apps\yourapp\yourapp.ini") OPEN appdisk$+":\System\Apps\yourapp\yourapp.ini",A,filestring$ lastfile$=A.filestring$ CLOSE ENDIFThat was the database version...
Here's the text file version.
LOCAL filehandle%,result% ~~~~~~ ~~~~~~ IF EXIST (appdisk$+":\System\Apps\yourapp\yourapp.ini") result%=IOOPEN(filehandle%,appdisk$+":\System\Apps\yourapp\yourapp.ini",$20) result%=IOREAD(filehandle%,ADDR(lastfile$)+1,255) POKEB ADDR(lastfile$),result% result%=IOCLOSE(filehandle%) ENDIFMessy or what...
Some might say that the filename should have been built up in a string variable before being used, and that the address of the resultstring could have been calculated before being used. For those: Go ahead! It's your code.
In these examples I have used the appdisk$ variable to open the .ini file on the same disk as the program is stored. This is up to you...
This is NOT what the guides say that you should do... This was written early, before I knew better. (It really should be stored on the RAMdisk C: ) This section hasn't been changed because it demonstrates the use of the appdisk$ variable. Don't forget that if your App uses .OPO modules or other files, they are most likely stored in the same folder as the main .APP file.
|<<5. Setting up the Data>>|