Initializes curses and its data structures for a specified terminal.
Curses Library (libcurses.a)
The newterm subroutine initializes curses and its data structures for a specified terminal. Use this subroutine instead of the initscr subroutine if you are writing a program that sends output to more than one terminal. You should also use this subroutine if your program requires indication of error conditions so that it can run in a line-oriented mode on terminals that do not support a screen-oriented program.
If you are directing your program's output to more than one terminal, you must call the newterm subroutine once for each terminal. You must also call the endwin subroutine for each terminal to stop curses and restore the terminal to its previous state.
Item | Description |
---|---|
InFile | Identifies the input device file. |
OutFile | Identifies the output device file. |
Type | Specifies the type of output terminal. This parameter is the same as the $TERM environment variable for that terminal. |
The newterm subroutine returns a variable of type SCREEN *. You should save this reference to the terminal within your program.
fdfile = fopen("/dev/lft0", "r+");
Then, use the newterm subroutine to initialize curses on the terminal and save the new terminal in the my_terminal variable as follows:
char termname [] = "terminaltype";
SCREEN *my_terminal;
my_terminal = newterm(termname,fdfile, fdfile);
fdifile = fopen("/dev/lft0", "r");
fdofile = fopen("/dev/tty0", "w");
SCREEN *my_terminal2;
my_terminal2 = newterm("ibm3151",fdofile, fdifile);
char termname [] = "terminaltype";
SCREEN *my_terminal;
my_terminal = newterm(termname,stdout,stdin);