Bonjour,
J'ai un problème j'ai rechercher un peut partout mais je suis débutant en programmation donc j'aimerai des explication.
Voila je veut enregistrer un type string dans un fichier mais je ne peut pas le lire :
void save()
...
FILE *f;
f = fopen("fichier.pers","w");
string nom;
cin>>nom;
fwrite(&nom,sizeof(string),1,f);
fclose(f);
...
void load()
...
FILE *f;
f = fopen("fichier.pers","r");
string nom;
fread(&nom,sizeof(string),1,f);
fclose(f);
cout<<nom<<endl;
Mais il n'y a rien qui s'affiche.Si quelqu'un c'est comment faire?
Jérôme