2

reading from text file

view story
linux-howto

http://www.daniweb.com – Hi, I'm reading from a text file and writing to another one.My problem is that the data is being written to the new file as one line..i.e., when the end of a line is reached it does not start writing a new line but continues on the same line.. Can someone please tell me how to make it write data line by line? this is my code..Any improvements and suggestions will be appreciated. Thanks #include<iostream.h> void main() { char *buffer; ofstream myfile; ifstream myfile1; myfile.open("book1.txt"); myfile1.open("book2.txt"); while(!myfile1.eof()) { myfile1.getline(buffer,'\t'); myfile<<buffer; } delete [] buffer; myfile.close(); myfile1.close(); } (General)