I have an Excell file that I need to read to be able to bring the cells into a struct. I have tried using fstream and I get garbage. How can i go about this??

Recommended Answers

All 8 Replies

Excel uses a proprietary format. Unless you know how to decode it, you won't be able to get very far. You might try exporting the excel file as a CSV or something...

If you're feeling adventurous, download OpenOffice's source code. It contains algorithms for reading Excel files, which you can implement in your program, under the GPL.

And if you don't like the idea of digging through mountains of source code, do what Infarction suggested, and try reading in a simple ASCII text file instead.

I found a third party util that will export the excell into cvs format. Now I am not that familiar with two dimension arrays. I have the cvs file with 3 rows and 20 colums. I also have two colums as strings and 1 as an int.

Thanks,

So your problem now is...?

I dont know the systax for the two dimensional arrays.

If you don't know how to handle 2d arrays, I'd say perhaps you aren't ready for reading in files.You should go back and study some more C/C++ until you at the very least have a solid understanding of arrays and how they work.

I dont know the systax for the two dimensional arrays.

two dimensional array is a funcy way of say an array of arrays, and you will declare it pretty much like a regular array.

example:

char  array[3]; /* This is an array of 4 elements */
char  array[2] [3]; /* These are three arrays that each one has 4 elements*/

Last one is a 2D array of type char.

Member Avatar for iamthwee

>I found a third party util that will export the excell into cvs format

Gee, I wonder why you didn't just go to:

File > save as > .csv

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.