ecco il mio source:
il problema sta nelle stringhe, coi numeri va tutto bene appena uso le stringhe va a cagare e non capisco il perchè...
l'errore è il seguente:
riga 31: [Warning] cannot pass objects of non-POD type `struct std::string' through `...'; call will abort at runtime
non capisco k ****** dice sto compilatore cesso
help me
Codice:
#include <conio.h>
#include <stdio.h>
#include <iostream.h>
#include <string>
using namespace std;
#define a "c:\\libreria.txt"
void proc ();
main()
{ int s;
do{
cout<<"1.inserisci"<<endl;
cout<<"2.esci"<<endl;
cin>>s;
proc ();
}while(s!=2);
return 0;
}
void proc()
{
string titolo;
string autore;
float prezzo;
cout<<"Inserisci titolo:";
cin>>titolo;
cout<<"Inserisci autore:";
cin>>autore;
cout<<"Inserisci prezzo:";
cin>>prezzo;
FILE *f;
f=fopen(a,"a");
fprintf(f,"%s\n",titolo);
fprintf(f,"%s\n",autore);
fprintf(f,"%f\n",prezzo);
fclose(f);
cout<<"scrittura eseguita!\n";
}
l'errore è il seguente:
riga 31: [Warning] cannot pass objects of non-POD type `struct std::string' through `...'; call will abort at runtime
non capisco k ****** dice sto compilatore cesso
help me