What will be the code for not overwriting the text file you make.

ofstream myfile;
  		myfile.open (home/.test.txt);
     		myfile << "test";
   		myfile.close();

Because the test.txt is needed to create only just once after you load the widget. I inserted that code to the mainWindow but whenever I loaded the mainWindow the test.txt is always do a new file with the same value test. But I need the test.txt to be read/write because I use it in a TextBuffer. Thanks!

myfile.open ("home/.test.txt",ios::app);

Oh I see. Thanks! This is right. But I putted a one line on the test.txt. if I use this

myfile.open ("home/.test.txt",ios::app);

Everytime you load the mainWindow the inputed one line is just add and add.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.