SHiVeR
June 1st, 2003, 02:54 PM
ok, this is what im trying to do. I have a program with 24 lookup tables defined in the globals:
const char lookup1[255][5] = {"blah","blah2","blah3".......};
const char lookup2[255][5] = {"blah","blah2","blah3".......};
const char lookup3[255][5] = {"blah","blah2","blah3".......};
Later in the program I need to reference these tables in a case statement, but these tables are user selected based upon what they want to see in the output. So the only way for the program to know is set another variable with the pointer to which table to use. I figured I could do this in an array such as:
char * prtarray[4];
And then define which table has been selected by assigning its pointer to the array, and then later pulling it out:
ptrarray[0] = &lookup1;
And then later I have the row I need out of the table, but the only way to reference it is through the pointer. So I was thinking of doing something like:
StrCat(strValue, (* ptrarray[0])[1]);
or something like that to pull the value out of the lookup table by referencing its pointer in an array previously set up. I would thus want strValue to contain "blah2". I know the syntax above isnt right, but that's what I want to do and is the best way for me to illustrate it. I've tried everything I can think of to get it to work, but I just can't do it.
ANY help would be greatly appreciated! Thanks in advance!
const char lookup1[255][5] = {"blah","blah2","blah3".......};
const char lookup2[255][5] = {"blah","blah2","blah3".......};
const char lookup3[255][5] = {"blah","blah2","blah3".......};
Later in the program I need to reference these tables in a case statement, but these tables are user selected based upon what they want to see in the output. So the only way for the program to know is set another variable with the pointer to which table to use. I figured I could do this in an array such as:
char * prtarray[4];
And then define which table has been selected by assigning its pointer to the array, and then later pulling it out:
ptrarray[0] = &lookup1;
And then later I have the row I need out of the table, but the only way to reference it is through the pointer. So I was thinking of doing something like:
StrCat(strValue, (* ptrarray[0])[1]);
or something like that to pull the value out of the lookup table by referencing its pointer in an array previously set up. I would thus want strValue to contain "blah2". I know the syntax above isnt right, but that's what I want to do and is the best way for me to illustrate it. I've tried everything I can think of to get it to work, but I just can't do it.
ANY help would be greatly appreciated! Thanks in advance!