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?
Configuration: Windows Vista
Firefox 3.0.3

2 réponses

  1. fiddy Messages postés 441 Date d'inscription   Statut Contributeur Dernière intervention   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