C program under Linux ------ Curses: Window

zhaozj2021-02-16  96

int main ()

{

WINDOW * new_WIN_PTR;

WINDOW * POP_WIN_PTR;

INT X_LOOP, Y_LOOP;

CHAR A_LETTER = 'A';

INITSCR ();

Move (5,5);

Printw ("% s", "testing multiple windows";

Refresh ();

For (y_loop = 0; y_loop

For (x_loop = 0; x_loop

{

Mvwaddch (STDSCR, Y_LOOP, X_LOOP, A_LETTER);

A_LETTER ;

IF (A_LETTER> 'Z') a_letter = 'a';

}

Refresh ();

Sleep (2);

NEW_WIN_PTR = NewWIN (10, 20, 5, 5);

Mvwprintw (new_win_ptr, 2, 2, "% s", "hello world!");

Mvwprintw (new_win_ptr, 5, 2, "% s", "Notice How long Lines Wrap Incide In this window, Hello World!");

WREFRESH (new_win_ptr);

Sleep (2);

A_LETTER = '0';

For (y_loop = 0; y_loop

For (x_loop = 0; x_loop

{

Mvwaddch (STDSCR, Y_LOOP, X_LOOP, A_LETTER);

A_LETTER ;

IF (A_LETTER> '9') a_letter = '0';

}

Refresh ();

Sleep (2);

Touchwin (new_win_ptr);

WREFRESH (new_win_ptr);

Sleep (2);

POP_WIN_PTR = NewWIN (10, 20, 8, 8);

Box (POP_WIN_PTR, '|', '-');

Mvwprintw (POP_WIN_PTR, 5, 2, "% S", "POP UP WINDOW!");

WREFRESH (POP_WIN_PTR);

Sleep (2);

Endwin ();

Exit (exit_success);

}

转载请注明原文地址:https://www.9cbs.com/read-10784.html

New Post(0)