|
|||||||
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jan 07
Posts: 27
![]() |
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();
}
Can any one plzz explain me? senthil. |
|
|
|
|
|
#2 |
|
Super Moderator
Join Date: Jan 05
Location: Sunny Adelaide
Posts: 12,532
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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. |
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|