You are refusing to use the library designed to do what you want, for the system you want, and instead farming out to a system utility which
uses that same library to do what you want.
To get it working, just get your package manager to install the
ncurses-dev library. If you have installed your GCC properly then you'll be ready to go. If not, you'll have to copy the
curses.h header from the system include path into wherever you stuck your GCC.
Next, in C::B, go to the options menu and tell it to link with
libncurses.
That's it. Compile happy. Frankly, this is all explained nicely in the
http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/
As for dealing with the backscroll buffer... that is something the terminal emulator handles, and the way to fix that is to start your terminal emulator with no backscroll lines allowed. For example, with
xterm, you'll need to start
xterm -sl 0 ...
Otherwise, if you can deal with resetting the terminal emulator, use the "rs1" terminal capability.
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include <unistd.h>
#include <term.h>
void ResetTerminal()
{
if (!cur_term)
{
int result;
setupterm( NULL, STDOUT_FILENO, &result );
if (result <= 0) return;
}
putp( tigetstr( "rs1" ) );
}
|
This may work fine on your system (it works fine in the default term on Fedora 19, BTW), but it may not work like you expect on your user's systems.
Good luck!