snippets / Lire dand un fichier .ini

Language: C++ - First posted by themadmax on 2007-10-5 13:53 (1 year, 1 month)
Link to the snippet: http://www.friendsnippets.org/snippet/75/

Fichier .ini dans le repertoire d'execution: [SECTION] key=value keyInt=123

1 char filename[MAX_PATH];
2 ::GetModuleFileName( NULL, filename, MAX_PATH-1);
3 string str = filename;
4 string path = str.substr( 0, str.find_last_of("\\") );
5 path += "\\config.ini";
6 char val[255];
7 ::GetPrivateProfileString( "SECTION", "key", "", val, sizeof(val), path.c_str() );
8 int iVal = ::GetPrivateProfileInt( "SECTION", "keyInt", -1, path.c_str() );
In order to post a comment, you should have a friendsnippet account. Please sign-in.

0 comments

Oct '07
  • Fichier .ini dans le repertoire d'execution: [SECTION] key=value keyInt=123

Common Tags


Related snippets