Probléme conversion de paramétre
Bonjour!
voici le code qui me pose soucis... (je suis débutant, donc merci d'être indulgent! :D)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Sign::SearchIP()
{
string strFileTemp = "c:\\orant\\logs\\IP.ini";
ifstream temp;
temp.open(strFileTemp.c_str());
if (temp.is_open())
{
string ligne;
int i = 1;
while (getline(temp, ligne))
{
strncpy( xIP[i], ligne.c_str(), 50); // erreur!
cout << xIP[i] << endl;
system("pause");
i++;
}
temp.close();
return true;
}
else
{
cout << "Impossible d'ouvrir le fichier.\n";
return false;
}
} |
donc pour la ligne où il y'a le commentaire erreur, j'ai ce message: error C2664: 'strncpy' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called.
Merci pour vos lumiéres!