home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20256 < prev    next >
Encoding:
Internet Message Format  |  1993-01-27  |  800 b 

  1. Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!paladin.american.edu!howland.reston.ans.net!spool.mu.edu!agate!doc.ic.ac.uk!warwick!uknet!bcc.ac.uk!mick
  2. From: mick@dcs.bbk.ac.uk (Mick Farmer)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Preprocessor question
  5. Keywords: Preprocessor, string
  6. Message-ID: <mick.728072797@picus>
  7. Date: 26 Jan 93 18:26:37 GMT
  8. References: <1993Jan25.161425.27962@bnrmtl.bnr.ca>
  9. Organization: Bloomsbury Computing Consortium
  10. Lines: 15
  11.  
  12. Hi,
  13.  
  14. Karim asks how to get a preprocessor macro recognised inside
  15. a string.  The answer, at least in ANSI C, is to use the
  16. stringising operator and string concatenation:
  17.  
  18. #define JUNK 50
  19. static char *junk = #JUNK " ways to leave your lover"
  20.  
  21. The construct #JUNK generates the string "50", which is
  22. concatenated with its neighbour.
  23.  
  24. Regards,
  25.  
  26. Mick
  27.