I have a file with about 100 #defines in it, from 1-100, and each with a unique string value.
Now I’m trying to print this value, but instead of the value, I want to print what the #define is. For example:
#define FIRST_VALUE 1 var = FIRST_VALUE; printf('%s', var);
and I want the printf to print FIRST_VALUE, not 1.
Is there any way to do this in C? Or must I just write out 100+ case blocks inside a switch statement?
After talking to one of my TA’s at school, we’ve decided that the best way to do this would be to write an AWK script to process the header file and automatically generate all the case statements needed.
Thanks guys!