Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   How to read this type of text file using C/C++? (http://www.go4expert.com/forums/read-type-text-file-using-c-cpp-t18381/)

imagine2200 6Jul2009 14:17

How to read this type of text file using C/C++?
 
hej everyone,

I opened MS word file in NOTEPAD and saved it as text file so that i can read the saved file using C/C++ streams. Below i have given image of MS word file opened in NOTEPAD and then i tried to read it using C/C++ streams but my programs reads the first few characters and then terminates. Why can't i read all these characters?

Any help in this regard will be appreciated.

Thanks

imagine2200 6Jul2009 14:18

Re: How to read this type of text file using C/C++?
 
http://i41.tinypic.com/nybvih.jpg

remove the spaces.

shabbir 6Jul2009 14:37

Re: How to read this type of text file using C/C++?
 
Spaces removed and you have messed up with your doc file and try renaming the file into doc file and see if it works.

xpi0t0s 6Jul2009 15:07

Re: How to read this type of text file using C/C++?
 
You can only read such files in binary mode. MS Word documents are not stored as text files.

Without code I can only guess why your program exits. Perhaps it quits at the first occurrence of a certain byte value, e.g. 0x00 or 0xFF. Maybe it crashes due to expecting text and getting binary.

Do you know how to decode MS Word documents?

naimish 6Jul2009 15:08

Re: How to read this type of text file using C/C++?
 
Are you people using VC++ ?

imagine2200 6Jul2009 15:10

Re: How to read this type of text file using C/C++?
 
@xpi0t0s

-

Nopes, i think that require knowledge of OLE and office automation.

imagine2200 6Jul2009 15:11

Re: How to read this type of text file using C/C++?
 
@naimish

-

I am using Dev-C++ IDE.

naimish 6Jul2009 15:11

Re: How to read this type of text file using C/C++?
 
Yeah...me 2 :)


All times are GMT +5.5. The time now is 13:35.