how to write in text file
-
hello friends plz tell me that how i can write in a text file from a buffer. and how i can search text file offset so that while writing in a file it shld not rewrite in the same position but it shld write in the position specified. thanx
Add ur header:
#include "fstream.h"
To write to File "Title.txt", at end of file.ofstream a_file ( "Title.txt", ios::ate, ios::app); a_file<< "Data"; a_file.close();
To read from File "Title.txt"char idata[256]; ifstream b_file ( "Title.txt" ); while (! b_file.eof() ) // From beginning to End of File. { b_file.getline(idata,256); cout<< idata < Hope it Helps... Replace the "Title.Txt" or "Data" with a variable and dont use the ""'s and you can have it set by user. Does this help? /* Just a Human Trying to Live in a Computers World. */