getprofilestring et c++ builder
salut a tous
je suis débutant en c++ builder
je voudrai bien récupérer ma chaine de caractére à partir d'un fichier que j'ai nomé "monfichier.ini" et ou j'ai mis ces lignes:
Code:
1 2 3 4
| [frensh]
command1=frensh.bmp
[english]
command1=english.bmp |
mais je n'ai pas reussi.
voilà ce que j'ai fait:
dans un fichier.h que ja'i inclu j'ai mis:
Code:
String GetProfileString(LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpDefault,LPTSTR lpReturnedString,int nSize,LPCTSTR fileName);
dans mon fichier.cpp j'ai mis le code suivant:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| void __fastcall TForm1::Button1Click(TObject *Sender)
{
//Form1->Hide();
if (FR->Checked)
{ strSection="frensh";
//strItem="command1";
}
else if (ENG->Checked)
{strSection="english";
//Button1->Caption="english";
}
char szTest[256];
strIntItem=GetProfileString(strSection, "command1", "TRUE", szTest, 256);
if (!strcmp(szTest,"TRUE") ) Button1->Caption=strIntItem; else Button1->Caption=strIntItem;
} |
probleme:
quand j'ajoute le nom de mon fichier strIntItem=GetProfileString(strSection, "command1", "TRUE", szTest, 256,"c:/Windows/monfichier.ini"); j'ai une erreur:extra parameter in call to_stdcal getprofilestringA(const char *,const char *,const char *,const char *,unsigned long)
et si je mets pas le nom de mon fichier il va diractement au fichier"win.in" et il me retourne un chifrre.
merci pour tout aide