Or you can do this:

const char* cat_control[2] = { CAT_CONTROL + '0', '\0' };

although this only works with single digit values ... :-)

Chris

Bob Withers wrote:

You need two levels, i.e.

#define CAT_CONTROL 7

#define STR1(x) #x
#define STR(x)  STR1(x)

printf("%s", STR(CAT_CONTROL));

Bob

At 11:36 AM 7/25/2003 -0300, you wrote:

Hi,

I have this constant, #define CAT_CONTROL 7

I want to convert CAT_CONTROL to const char * and I don't want to do this:

char cAux[2];
itoa(CAT_CONTROL ,cAux,10);

I try to use a preprocessor operator:

#define STR(x) #x

But that doesn't work, because I obtain "CAT_CONTROL" like result.

Any help would be greatly.

Best Regards,
German

--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/






-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to