Source Code File 06-03_text3
06-03_text3.c
#include <ncurses.h>
int main()
{
char text1[] = "This is the first line\n";
char text2[] = "Line two here\n";
char text3[] = "The third line\n";
char text4[] = "Fourth line here\n";
char text5[] = "And the fifth line\n";
initscr();
addstr(text1);
addstr(text3);
addstr(text5);
refresh();
getch();
move(1,0); /* Second line/row */
insertln(); /* add a blank line */
refresh();
getch();
addstr(text2);
refresh();
getch();
endwin();
return 0;
}
Output Screenshot

(Click to cycle through screenshots.)
Notes
* The insertln() function doesn't alter the cursor's location, so the string added at Line 24 appears on the blank row. However:
* Because the string in the addstr() statement (Line 24) contains a newline, the cursor's location is affected.
Copyright © 1997-2025 by QPBC.
All rights reserved
