Read ini From Windows Dir

06/17/2012 13:48 PsychoXReaper#1
hey guys i wanna help on how to Read a ini From a Windows path since some people have their windows on "E,D,F" ETC not only the "C" Drive
thats the code to read

GetPrivateProfileIntA("Section", "Key", Default Value,"my_file.ini")
06/17/2012 14:32 2n0w#2
getenv("SystemDrive");
Returns char*.
If you mean the Windows dir, you could also use getenv("WINDIR").
By the way:
Quote:
This function is provided only for compatibility with 16-bit Windows-based applications. Applications should store initialization information in the registry.
06/17/2012 16:11 Tyrar#3
Code:
TCHAR path[MAX_PATH]; // nothing to say?
GetSystemDirectory(path,MAX_PATH); // copy system path into 'path'
lstrcat(path,_T("\\yourfile.ini")); // append "\yourfile.ini" to 'path'

GetPrivateProfileInt(_T("Section"),_T("Key"),DefaultValue,path); // read value
this should work.