Dear all,
I have problem with reading from ini file. My code is as follows, but it has Error with GetPrivateProfileInt. It cannot read and the error is :
error C2664: 'GetPrivateProfileIntW' : cannot convert parameter 1 from 'const char [9]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Please Help
--------------code-------------
void ReadIniFile(const char* inifile)
{
printf("Reading: %s\n", inifile);
char entry[128];
res=GetPrivateProfileInt("settings", "resolution", 256, inifile); /* resolusi paparan */
hres=res/2;
GetPrivateProfileString("settings", "brightness", "2.5", entry, 128, inifile);
brightness=atof(entry);
step=GetPrivateProfileInt("settings", "step", 2, inifile); /* untuk jeda masa bagi rendering */
GetPrivateProfileString("settings", "near", "0.1", entry, 128, inifile); /* ketipan viewplane */
near_plane=atof(entry);
GetPrivateProfileString("settings", "far", "40.0", entry, 128, inifile);
far_plane=atof(entry);
double angle=GetPrivateProfileInt("settings", "smooth_angle", 2, inifile); /* sudut pengujian bagi normal segitiga */
cos_angle=cos(angle * 3.1415927 / 180.0); /* darjah->radian */
GetPrivateProfileString("settings", "stop_at", "0.0001", entry, 128, inifile);
converged=atof(entry);/* nilai penumpuan */