ANSI CPP string concatenation
Dave Harris
Dave.Harris at f14.n15.z1.fidonet.org
Sun Jun 23 00:40:59 AEST 1991
>From: nigel at cnw01.storesys.coles.oz.au (Nigel Harwood)
>Does anyone know if you can append strings in ANSI C.
>For example I want a macro which appends one of its numeric
>arguments to a string coded into the marco.
>#define APPEND(x,v) { donothing+x = v; }
>I know that the '+' isn't what I'm after but using whatever the method
>turns out to be what I want it to generate from APPEND(1,123) is:
> { donothing1 = 123; }
>Anyone know the secret ?
The secret is to use an array (like donothing[5]) or a lookup table. This
would be considered a better style unless you are using this differently than
I think you are trying to use this....
but... Mine is not the place to ask.
#define APPEND(x,v) donothing##x = v
--
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!15!14!Dave.Harris
Internet: Dave.Harris at f14.n15.z1.fidonet.org
More information about the Comp.lang.c
mailing list