AnsweredAssumed Answered

How to #define a string of non-printable characters? (eg as array {0xnn,0xnn, 0xnn} etc.)

Question asked by FridgeFreezer on Mar 17, 2011
Latest reply on May 3, 2011 by FridgeFreezer

I'm sure there's a simple way of doing this but CW (7.2 for Coldfire) keeps throwing errors "Illegal implicit onversion from 'char' to 'const char*' when I try to compile this code.

 

Basically we have a text display where users set a bit-field like "01011101", currently it selects the on/off characters from this constant string:

const char    *ascii_bits         = "01";

 

Because I want to change it to a couple of #defined special characters (not ASCII printable) to give a display of "blocks" like "_#__###_" we have set in the display device's charset, I can't enter the string as "XY", so I thought I'd do it array style:


#define BLOCKS_ON            (char)0xEE
#define BLOCKS_OFF         
(char)0xF2

const char    *ascii_blocks        = { BLOCKS_OFF, BLOCKS_ON, NULL}; // include string terminator (null)

 

But CW doesn't like this and throws an error. Can anyone tell me the correct way to go about this?

Outcomes