On 5/25/06, Joerg Wunsch <address@hidden> wrote:
"Royce Pereira" <address@hidden> wrote:
> Sorry for my rusty C, but how does one insert a hex value into a string?
> I tried
> const char messg[] PROGMEM= "Temp= \xdfC";
> and
> const char messg[] PROGMEM= "Temp= \xdf\C";
That's the exact reason why C89 invented the feature to concatenate
adjacent strings into one. You can write
const char messg[] PROGMEM= "Temp= \xdf" "C";
should'nt the array be declared as const unsigned char
Or, you could improve readability by
#define DEGREE "\xdf"
...
const char messg[] PROGMEM= "Temp= " DEGREE "C";
Hexadecimal or octal escape sequences stop at the first character that
does not belong to their respective character set, that's why your
first variant didn't work (the "C" is a valid hex character). In
traditional K&R C, there were no hexadecimal escape sequences, and
IIRC octal escape sequences artificially stopped after the third octal
digit.
--
cheers,
J"org
.-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC:
JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list