define constants within strings

David Coffing ssp at AMES-NAS.ARPA
Fri Mar 1 04:59:40 AEST 1985


Is there a way to insert a define constant into the middle of a quoted
string at compile time? I have some site-dependent menu headers and am
always annoyed when I have to "sprintf" them before using them.

#define	SITE	"Ames Research"

char	title2[] = " - Fancy Title";
char	title[80];

	sprintf(title, "%s%s", SITE, title2);
	domenu(title);

The pre-processor should have something that helps. Please repond via mail.

Chuck Collins		cpc at ames-nas     {ihnp4,hplabs}!ames!amelia!cpc



More information about the Comp.lang.c mailing list