Re: [cc65] Print heart character on C64?

From: Spiro Trikaliotis <>
Date: 2004-12-01 10:32:53

I'm sorry for this rather late followup, but I have an additional
question w.r.t this theme. Since the mail is rather old, I'm quoting
more than usual, as some people might not have the original left
(although, isn't there a mail archive?)

* On Sun, Sep 19, 2004 at 10:44:52PM +0200 Ullrich von Bassewitz wrote:
> As others have already explained, cc65 does a translation from the source
> character set into the target character set for all character and string
> literals. If cc65 wouldn't do that, things like
>         printf ("Hello world!\n");
> would not work as expected.
> There are several ways to work around it, if you don't like what cc65 does:
>   3. Don't use string literals, use char arrays instead:
>         const char foo [] = { 'H', 'e', 'l', 'l', 'o', 0x73, 0x00 };

In this case, what is translated, and what not? Above, you told that
CC65 translates all string and character literals. From this, I assume
'H', 'e', 'l', 'o' are translated. Correct?

But 0x73, 0x00 are no character literals, so, they are not translated.

Now, let's suppose I want to write something like

 sprintf(buffer, "M-W\0x01\0x02\0x03");

This string literal would be translated, thus, it is not a good idea.

Now, should

 sprintf(buffer, "M-W%c%c%c", 0x01, 0x02, 0x03);

show the expected behaviour? Or do I have to use the char array, as

Is this behaviour guaranteed from the C standard?

Thanks for any explaining,

Spiro R. Trikaliotis
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Dec 1 10:32:59 2004

This archive was generated by hypermail 2.1.8 : 2004-12-01 10:33:09 CET