string literal - character code
clovekx

How to insert a character into the string by the characters numeric code?

this works:

printf("%c",0x81);

but these dont:

printf("\x80");
printf("\200");
printf("%c",'\x80');

What's wrong with them? I'm using mingw.

EDIT: Now I see it works with standard printf, but doesnt with texprintf_ex, because char is signed and the value 0x80 is negative.

Andrei Ellman

Are you trying to print the Euro sign? While it's position in the Windows-1252 encoding is 0x80, it's position in the ISO 8859-15 is 0xA4.

As for Allegro's texprintf_ex(), Allegro uses UTF-8 by default, which means that unless you change the text-encoding format with set_uformat(), you must specify character constants in UTF-8 format.

AE.

GullRaDriel

Little help:

set_uformat( U_ASCII );

Beaten ... I should take less time speaking of hdd's with HoHo ;-p

clovekx

Thanks. Setting uformat works.

Tobias Dammers

Always does.
You could also use a text editor that supports UTF-8 (scite for example does), but I that'd be hackish, and generally unreadable on a non-utf8-editor. It is very useful when working with XML, though.

Thread #590410. Printed from Allegro.cc