Probleme c++ strings

Résolu
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?

2 réponses

fiddy Messages postés 11653 Statut Contributeur 1 847
 
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
0
wawa
 
OUPS...
MERCI :)
0