You are here:

C/Replacing words in DOC files

Advertisement


Question
Dear sir,
Hello !

I have a DOC file named "Letter1.DOC"; I also have an exe file named "Repl.Exe". I want to develope this repl.exe so that it is able of replacing some special words in "Letter1.DOC" like "My", with another word.

Let me know how I can replace words in a DOC file. Notice that I want my program to do so, that is I do not want to do that using Word2000.exe manually.

Thank you very much.

Answer
You will have to learn file management in C.
1. Open the file.
2. Read the contents.
3. Search for the word.
4. Replace with a new word.
5. Write back the contents into the file.

Hope this helps....
If you have any specific problems please let me know. If you have already written the code and are facing problem, then do post the code, so that I can debug it.

-ssnkumar

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.