getting data from non-.txt files properly
-
Is there any way to read files such as .doc, .xls and load their data into a buffer? I used fstream functions to open a file, get its data and put its data in another file. on .txt files it's able to take that data and successfully place it in another txt file fine. however it's not the same for .doc or .xls files (get weird characters, possibly japanese :wtf: ). was wondering if anyone could suggest an alternative, or a fix on reading data from non .txt files properly. thanks
-
Is there any way to read files such as .doc, .xls and load their data into a buffer? I used fstream functions to open a file, get its data and put its data in another file. on .txt files it's able to take that data and successfully place it in another txt file fine. however it's not the same for .doc or .xls files (get weird characters, possibly japanese :wtf: ). was wondering if anyone could suggest an alternative, or a fix on reading data from non .txt files properly. thanks
Well, .doc and .xls files are binary files. They do not only contain text, but also all extra information (formating, styles, ...). Otherwise, where would this information be saved ? If you want to read the data in them, you have to use automation (google for word automation and excell automation). The subject is a bit too broad to cover here. For other file types, it really depends of which type of file you want to open. Each file type has its own format, and you either need to parse the file accordingly to the format (which is probably a though job) or find libraries that do that for you.
Cédric Moonen Software developer
Charting control [v2.0] OpenGL game tutorial in C++ -
Well, .doc and .xls files are binary files. They do not only contain text, but also all extra information (formating, styles, ...). Otherwise, where would this information be saved ? If you want to read the data in them, you have to use automation (google for word automation and excell automation). The subject is a bit too broad to cover here. For other file types, it really depends of which type of file you want to open. Each file type has its own format, and you either need to parse the file accordingly to the format (which is probably a though job) or find libraries that do that for you.
Cédric Moonen Software developer
Charting control [v2.0] OpenGL game tutorial in C++Just the thing I was afraid of :( thanks Cédric
-
Is there any way to read files such as .doc, .xls and load their data into a buffer? I used fstream functions to open a file, get its data and put its data in another file. on .txt files it's able to take that data and successfully place it in another txt file fine. however it's not the same for .doc or .xls files (get weird characters, possibly japanese :wtf: ). was wondering if anyone could suggest an alternative, or a fix on reading data from non .txt files properly. thanks
Hello, You've been explained why you can't just open and read XLS and DOC files. To read XLS files, you can try BasicExcel - A Class to Read and Write to Microsoft Excel[^] or XLW[^]. There are such wrappers around to read/write DOC files as well, just do a search. :)
It is a crappy thing, but it's life -^ Carlo Pallini
-
Hello, You've been explained why you can't just open and read XLS and DOC files. To read XLS files, you can try BasicExcel - A Class to Read and Write to Microsoft Excel[^] or XLW[^]. There are such wrappers around to read/write DOC files as well, just do a search. :)
It is a crappy thing, but it's life -^ Carlo Pallini
I've heard of the ADODB abstraction class, and I've seen it used successfully in VB codes (loading as bytes), but would that come under managed C++? thanks
-
I've heard of the ADODB abstraction class, and I've seen it used successfully in VB codes (loading as bytes), but would that come under managed C++? thanks
No, the class I referred to is not managed code.
It is a crappy thing, but it's life -^ Carlo Pallini