character strings, macros, ANSI c, multicharacter chars question
Ted Schroeder
ted at ultra.com
Fri Jan 5 06:04:31 AEST 1990
I have a macro that needs to turn an argument into a character string.
I notice in IBM/370 C there is a # operator that will do just this.
Is this proper ANSI C?
Here's an example:
#define PRINTS(a) printf("%s\n", #a);
Also, I would like to create an integer that is full of '+' characters
i.e. on an ASCII machine the four byte integer would be 0x2b2b2b2b.
Unfortunately the code must run on both ASCII and EBCDIC machines.
Right now I do the following
#ifdef ASCII
#define PLUS 0x2b2b2b2b
#else /* EBCDIC */
#define PLUS 0x4e4e4e4e
#endif /* ASCII */
Is there any portable way to do this?
Thanks in advance for your help.
Ted Schroeder ted at Ultra.com
Ultra Network Technologies ...!ames!ultra!ted
101 Daggett Drive
San Jose, CA 95134
408-922-0100
Disclaimer: I don't even believe what I say, why should my company?
More information about the Comp.lang.c
mailing list