<FSTREAM>

Hello, i'm having a problem.
the text does not is written.
i don't know how to solve.
so please, help me.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void PutFrag(int kills, int misses, string name, string path){
    string date = currentDateTime(false);
    path += "\\data\\Output\\Frag.txt";
    date = currentDateTime(true);
    fstream txt(path.c_str());
    string in = "";
    if(txt.is_open()){
        //date << "={Username : " << name << endl << "Kills : " << kills << endl << "Misses : " << misses << "}";
        stringstream temp;
        while(!txt.eof()){
            string str;
	        getline(txt, str);
	        temp << str;
        }
        temp << date << "={Username : " << name << endl << "Kills : " << kills << endl << "Misses : " << misses << "}";
        txt << temp;
        gotoxy(0,4);cout << temp.str();
        txt.close();
    }else{
        gotoxy(0,1);cout << "FAIL";
    }
    gotoxy(0,0);cout << path;
}
http://stackoverflow.com/a/15673510/3410396
it's also worth noting that between reads and writes on an fstream you must either flush the buffer or seek the file position when changing from output to input, and you must either be at the end of the file or seek the file position when changing from input to output.
Topic archived. No new replies allowed.