String and Constant #defines ?
dan at rna.UUCP
dan at rna.UUCP
Thu Feb 23 05:18:12 AEST 1984
Hi,
Is there anyway of generating a string definition from a constant
definition in the C preprocessor ? I want to do something like:
#define MSIZE 100
int msize = MSIZE;
char *csize = "MSIZE";
This, of course doesn't work, csize gets "MSIZE", not "100". But
neither does:
#define MSIZE 100
#define string(x) "x"
int msize = MSIZE;
char *csize = string(MSIZE);
Haven't found a permutation that will work. Thanks.
Cheers,
Dan Ts'o
...cmcl2!rna!dan
More information about the Comp.lang.c
mailing list