Probleme c++ strings
Résolu
wawa
-
wawa -
wawa -
Bonjour,
J'ai un probleme avec une fonction c'est vraiment tres tres etrange:
string nom="test"; //ICi gros probleme avec les types string sous unix
ofstream fichier(nom,ios::out | ios::binary); ------------> ca ne marche pas
string nom="test"; //ICi gros probleme avec les types string sous unix
ofstream fichier("blablabla",ios::out | ios::binary); ------------> ca marche
qulqun a une idée?
J'ai un probleme avec une fonction c'est vraiment tres tres etrange:
string nom="test"; //ICi gros probleme avec les types string sous unix
ofstream fichier(nom,ios::out | ios::binary); ------------> ca ne marche pas
string nom="test"; //ICi gros probleme avec les types string sous unix
ofstream fichier("blablabla",ios::out | ios::binary); ------------> ca marche
qulqun a une idée?
2 réponses
Non, rien d'étrange.
Le prototype du constructeur de ofstream est : ofstream(const char*, int = ios::out, int = filebuf::openprot);
On voit bien donc que le premier argument est un char* est non un string.
Remplace donc string nom="test" par char *nom="test"; et tout devrait rentrer dans l'ordre.
Cdlt
Le prototype du constructeur de ofstream est : ofstream(const char*, int = ios::out, int = filebuf::openprot);
On voit bien donc que le premier argument est un char* est non un string.
Remplace donc string nom="test" par char *nom="test"; et tout devrait rentrer dans l'ordre.
Cdlt