Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think.com!compass!parks From: parks@compass.com (John Parks) Newsgroups: comp.lang.c Subject: Need help with quoting and the CPP Message-ID: <5209@compass.com> Date: 22 Apr 91 17:25:05 GMT Sender: root@compass.com Lines: 25 Brett Bergquist writes: Is there any way to expand an argument to a macro and at the same time surround it with quotes (making is a quoted string). Interesting question! If you have an ANSI CPP, it will take two macros (here given as STR and QUOTE). #define greeting hello Jennifer #define STR(x) #x #define QUOTE(x) STR(x) QUOTE(greeting) will expand to "hello Jennifer" The ANSI stringization operator stringizes an "unexpanded" actual parameter list, hence a two-step method is needed to force the expansion. -- John Parks Compass Inc. 550 Edgewater Drive Wakefield, MA 01880 ddddddd