tnk!
Ma cosi non va:
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, temp_read; 
    bool trovato = false; 
    ifstream in(nome.c_str()); 
        while (in)  
        { 
            temp_read = in.get();    
        } 
        out = temp_read.substr( 0, temp_read.find( "%end" ) );
    in.close();    
    return out.c_str(); 
}