If you want to save the pathname and make it default, it is useful to create
an ini file.
Youcan save the complete pathname (includng the backslash characters using
the
Ini_PutRawString () function (it is in the "Reading-writing ini files fp")
as the standard PutString function misinterprests the backslash character in
the path name and uses it as control code.
The ini file can be loaded by the main program and set teh current directory
according to the saved velue
Ini_Text Defaults;
Defaults = Ini_New (0);//creates an unsorted in memory ini ascii database
//at the start, read the ini file containing the default values using the
Ini_ReadFromFile ();
if missing, create an in file programatically, and save it like below:
//find out what is your default directory or
specify it yourself, that save
the data into in meory ini database you can use funtions from the Utility
library directory utilities toolset for this.
Ini_PutRawString (Defaults,"DEFAULT_DIR","PATHNAME","c:\current dir\my
default directory and \filename.tmp") ;
Ini_PutRawString (Defaults,"DEFAULT_DIR","DRIVENAME,drivename) ;
//you may parse the pathname if you need it and store it as before, the
result will be something along these lines:
Ini_PutRawString (Defaults,"DEFAULT_DIR","DRIVENAME",drivename);
Ini_PutRawString (Defaults,"DEFAULT_DIR","DIRNAME",dirname)
....
....
[DEFAULT_DIR]
PATHNAME="c:\current dir\my defaultdirectory and \filename.tmp"
DRIVENAME="c:"
DIRNAME="\current dir\my defaultdirectory and\"
FILENAME="filename.txt"
//I am not sure the exact location of backslash characters, watch the
location of backslash charaters, make sure that are properly placed
To read the pathname data use the Ini_GetRawStringIntoBuffer() function
whichever element you need.
Update the da
ta if changed during program run, and when exiting save the ini
file with the current data using standard file name and location, that you
can find when restart your program.
good luck
Lajos