Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!ncar!asuvax!stjhmc!f14.n15.z1.fidonet.org!Dave.Harris From: Dave.Harris@f14.n15.z1.fidonet.org (Dave Harris) Newsgroups: comp.lang.c Subject: ANSI CPP string concatenation Message-ID: <14694.28636301@stjhmc.fidonet.org> Date: 22 Jun 91 14:40:59 GMT Sender: ufgate@stjhmc.fidonet.org (newsout1.26) Organization: FidoNet node 1:15/14 - Nibbles 'n Bits, Orem UT Lines: 31 >From: nigel@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@f14.n15.z1.fidonet.org