| | |
please help me on this...:(
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
for example you have a:
string test;
how can I just add or insert a value on the file(test.txt). not just overwrite the file(test.txt) when the function(on_clicked) is being called.
All I need is if the function(on_clicked) is being called. The value of test is must add/insert(not ovewrite it) on the file(test.txt).
please help me.... thank you!
string test;
C++ Syntax (Toggle Plain Text)
void ExampleWindow::on_clicked(){ ofstream myfile; string test; myfile.open ("/home/ws14/Desktop/trunk/minisip/minisip/share/test.txt"); mydialfile << test; mydialfile.close(); }
how can I just add or insert a value on the file(test.txt). not just overwrite the file(test.txt) when the function(on_clicked) is being called.
All I need is if the function(on_clicked) is being called. The value of test is must add/insert(not ovewrite it) on the file(test.txt).
please help me.... thank you!
The easiest way would be to use the ios::app flag, this will open the file in append mode if the file exists, if it can't find the file, a new one will be created.
Cheers for now,
Jas.
C++ Syntax (Toggle Plain Text)
ofstream myfile; myfile.open("path\filename.ext", ios::app );
Cheers for now,
Jas.
If you're into metal, check out my new band at:
http://www.myspace.com/kinasis
Now booking gigs for 2010....
http://www.myspace.com/kinasis
Now booking gigs for 2010....
This is my next question: how to get a document from root?
because I have this code:
But I need to change the path home/ws14 if I change user. Thanks!
because I have this code:
C++ Syntax (Toggle Plain Text)
myfile.open ("/home/ws14/Desktop/test.txt");
But I need to change the path home/ws14 if I change user. Thanks!
![]() |
Other Threads in the C++ Forum
- Previous Thread: how to convert c to c++
- Next Thread: Visual C++ help?
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft multidimensional newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






