Voglio leggere una determinata stringa che ho precedentemente salvato e leggerla fino ad un carattere stabilito( %end ).
Ho provato cosi:
Ma mi dacodice:#include <iostream> #include <sstream> #include <fstream> #include <string> using namespace std; int main() { return 0; } void scrivi(string nome, string text) { string cosa; stringstream temp_write; ofstream out(nome.c_str()); temp_write << text; text = temp_write.str(); out << text << "%end" << text; out.close(); } string leggi(string nome) { string cosa; stringstream temp_read; ifstream in(nome.c_str()); while(in.get() != "%end") { temp_read << in.put(); } cosa = temp_read.str(); return cosa; }
C:/Documents and Settings/Admin/Desktop/Test.cpp:29: ISO C++ forbids comparison
between pointer and integer
C:/Documents and Settings/Admin/Desktop/Test.cpp:31: no matching function for
call to `std::basic_ifstream<char, std::char_traits<char> >:ut()'
.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
Ciao da Kleidemos
C++ Programmer
.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.