Results 1 to 2 of 2

Thread: How to read the contents of a doc file and write the contents into another doc file?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    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();
    }
    what shall i do for doc files...

    Can any one plzz explain me?

    senthil.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width