hello i have had trouble finding a ansure on google so im posting on this forum
how do you write a string to a .ini file
how do read read a section from a ini file and set it as a string
please do not give advice on .txt files
WritePrivateProfileStringA( "YourProgramName","keyname","value","C:/pathto/yourfile.ini" );
// writes
// keyname=value
// in the [YourProgramName] section of yourfile.ini
To read:
1 2 3 4 5 6 7
char mybuffer[100];
GetPrivateProfileStringA( "YourProgramName","keyname","defaultvalue",
mybuffer,100,"C:/pathto/yourfile.ini");
// reads keyname from the [YourProgramName] section of yourfile.ini and puts it in mybuffer
// if no keyname exists, "defaultvalue" is used instead
EDIT: note I'm using the 'A' versions (WritePrivateProfileStringA and GetPrivateProfileStringA) because I'm using char arrays in the example.
It will still work. All that means is that .ini files are "outdated" and modern programs probably shouldn't be using them (according to that page, anyway).
You still can use them and the above functions will work just fine, though.