PrintToScreen vs printf escape sequences

I am just getting started with WPILib under MPLAB 8.1 and C18 2.4.
I followed the WPI instructions for building the “Hello World” project and everything worked.
I added a called to the color control routine and everything worked. (Code follows)
The output is:

Hello World
In color

The three warning messages irritated me, so I changed printf to PrintToScreen. That got rid of the warnings, but the output is no longer correct

The output is:
0;7680;12032mHello World
0;7936;12032mIn color

It looks like PrintToScreen is stripping off the ESC control character needed by Tera Term for terminal control operations.

Any suggestions?

The code is:
#include “API.h”

#define RESET 0
#define BRIGHT 1
#define DIM 2
#define UNDERLINE 3
#define BLINK 4
#define REVERSE 7
#define HIDDEN 8

#define BLACK 0
#define RED 1
#define GREEN 2
#define YELLOW 3
#define BLUE 4
#define MAGENTA 5
#define CYAN 6
#define WHITE 7

void textcolor(int attr, int fg, int bg);
void main (void)
{
while (1)
{
textcolor(RESET, BLACK,WHITE);
PrintToScreen(“Hello World\r”);
Wait(1000);
textcolor(RESET, RED, WHITE);
PrintToScreen(“In color\r”);
Wait(1000);
}
}
void textcolor(int attr, int fg, int bg)
{
/* Send color command to the terminal */
PrintToScreen("%c%d;%d;%dm",0x1B, attr, fg + 30, bg + 40);
}