Cosi nn compare nulla

codice:
#include <iostream>
#include <cstdio>
#include <sstream>
#include <fstream>
#include <string>
using namespace std;
void scrivi(string, string);
string leggi(string);
int main()
{
int sc;
string test = "this.txt", txt = "ioioio";
scrivi(test, txt);
cin >> sc;
if(sc == 1)
{
cout << leggi(test) << endl;
}
system("PAUSE");
return 0;
}
void scrivi(string nome, string text)
{
stringstream temp_write;
ofstream out(nome.c_str());
temp_write << text;
text = temp_write.str();
out << text << "%end%" << "ciao";
out.close();
}
string leggi(string nome)
{
string out, tmp, temp_read;
bool trovato = false;
ifstream in(nome.c_str());
while (in.good())
{
temp_read = in.get();
}
while(temp_read != "\0")
{
if(temp_read == "%end%")
{
out = temp_read;
trovato = true;
}
if(trovato)
continue;
}
in.close();
return out.c_str();
}