Hi,
Let's say I have a program that defines a few variables..
int var1, var2, var3;
Then, printing out those values to a file...
fprintf(fp,"%d,%d,%d", var1,var2,var3);
...is easy. But what if I don't know ahead of time which ones or even how many the user wants to print out?
char varString[80];
printf("Please enter the name of the variable you want to print: "
gets(varString);
The main thing here is, how can I associate the string entered by the user, with the name of the variable? Maybe I'm not thinking cleary on this, but I don't think I've run into this before.
Thanks for any help.
-Tyler
Let's say I have a program that defines a few variables..
int var1, var2, var3;
Then, printing out those values to a file...
fprintf(fp,"%d,%d,%d", var1,var2,var3);
...is easy. But what if I don't know ahead of time which ones or even how many the user wants to print out?
char varString[80];
printf("Please enter the name of the variable you want to print: "
gets(varString);
The main thing here is, how can I associate the string entered by the user, with the name of the variable? Maybe I'm not thinking cleary on this, but I don't think I've run into this before.
Thanks for any help.
-Tyler