ADAM'S WEB PRESENCE

18 July 2007

NCURSES Weirdness on Linux Console

Filed under: Nerd Notes — adam @ 5:15 pm

I’ve been writing an application using ncurses under Linux. Everything was going fine until I tried to run it on the Linux console (all my testing had been in an xterm). Suddenly all my borders and fields were all over the place and stuff was not being rendered correctly.

After a lot of research, I found that there are some problems with the Linux TERM settings. To cut a long story short, there is a real simple fix. you just need to print a certain magic escape code and the problem goes away.

So as the first line of my program, I put this:

cout << "\\033c";

In C, that would be:

printf("\\033c");

You can even do it from a script:

echo -ne "\\033c"

It took a lot of Googling to figure that out. I’m not sure exactly why it works but there you go.

For the record, I am using Debian “stable” with kernel 2.6.18.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment


Powered by WordPress