Newsgroups: comp.lang.c Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!lethe!druid!darcy From: darcy@druid.uucp (D'Arcy J.M. Cain) Subject: Re: help with a macro Message-ID: <1991May11.230658.29947@druid.uucp> Organization: D'Arcy Cain Consulting, West Hill, Ontario References: <595@afc-tci.UUCP> Date: Sat, 11 May 91 23:06:58 GMT In article <595@afc-tci.UUCP> joubert@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@druid) | D'Arcy Cain Consulting | There's no government Toronto, Ontario, Canada | like no government! +1 416 424 2871 |