How to read the contents of a doc file and write the contents into another doc file?
Hai to all,
i had tried to read the contents of a text file and write that contents into
another text file...
But when i used the same codings for reading the contents of a ms word doc file and writing it into another ms word doc file, itz not working...
Here the codings i had used...
Code:
#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
using namespace std;
void main () {
string line;
ifstream myfile ("C:/1.doc");
if (myfile.is_open())
{
while (! myfile.eof() )
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
}
else cout << "Unable to open file";
ofstream myfile1;
myfile1.open ("C:/2.doc");
myfile1 << line;
myfile1.close();
getch();
}
what shall i do for doc files...
Can any one plzz explain me?
senthil.
Re: How to read the contents of a doc file and write the contents into another doc fi
Files are files.
http://www.cplusplus.com/doc/tutorial/files.html
And indent your code, otherwise no-one will read it.