Quote:
Originally Posted by BugHunter
One more thought: if you maintain the tables not in MS-only XLS format but use CSV sheets, you can access them with everything you want, since they are text only.
Going on from this since a CSV value file is text it can easily be read into a program.
You have to read a table, the reason that you are being advised to use arrays is that a 2 dimensional array is very like a table in that you access it using 2 indexes which, in this case can be thought of as your row and column.
Do you understand what an array is?
You could easily read the file into an 2 dimensional array of strings. Of course in C a string is a 1 dimensional array of characters so what you need is a 3 dimensional array of characters delared something like
-
#define MAX_ROWS 10
-
#define MAX_COLUMNS 10
-
#define MAX_CELL_TEXT 20
-
-
char Table[MAX_COLUMNS][MAX_ROWS][MAX_CELL_TEXT+1];
-
Note the plus 1 is to take account of the zero terminator that c uses in strings.
Then all you have to do is read the lines of the CSV file, parse each line into it's separate cells and plonk the contents of each cell into the correctentry in the array.