Hi guys ;) I have a problem to read the ini file :
And ..
In the main, when i put this code :
The console write the default value : "Defalut", how i to do for the console write the value that is in the config?
PHP Code:
//ini.cpp
ReadIni::ReadIni(char *szFileName)
{
memset(m_szFileName, 0x00, 255);
memcpy(m_szFileName, szFileName, strlen(szFileName));
}
char* ReadIni::String(char *szSection, char *szKey, const char *szDefaultValue)
{
char *szResult = new char[255];
memset(szResult, 0x00, 255);
GetPrivateProfileString(szSection, szKey, szDefaultValue, szResult, 255, m_szFileName);
return szResult;
}
PHP Code:
//ini.h
class ReadIni
{
private:
char m_szFileName[255];
public:
ReadIni(char *szFileName);
char *String(char *szSection, char *szKey, const char* szDefaultValue);
};
PHP Code:
ReadIni *Read = new ReadIni(".\\config.ini");
std::string read = Read->String("Section","Key","Defalut");
std::cout<<read<<std::endl;