help with a macro
D'Arcy J.M. Cain
darcy at druid.uucp
Sun May 12 09:06:58 AEST 1991
In article <595 at afc-tci.UUCP> joubert at afc-tci.UUCP (Joubert Berger) writes:
>I want to define a macro, lets call it UNDERLINE that would take a string
>as a parameter. This macro should add some characters in front and behind
>the string. Is this possible?
> fprintf(f, "%s\n", UNDERLINE("test"));
>Am I asking to much of the preprocessor?
Not at all. Here is the macro
#define UNDERLINE(x) "pre string" x "post string"
Note that this only works with string constants but you knew that.
--
D'Arcy J.M. Cain (darcy at druid) |
D'Arcy Cain Consulting | There's no government
Toronto, Ontario, Canada | like no government!
+1 416 424 2871 |
More information about the Comp.lang.c
mailing list