标签:style blog color ar 使用 sp for div art
使用下面两个函数来进行创建子窗口
#include<curses,h>
WINDOW *subwin(WINDOW *parent,int num_of_lines,int num_of_cols,int start_y,int start_x);
int delwin(WINDOW *window_to_delete);
1 #include<unistd.h> 2 #include<stdlib.h> 3 #include<curses.h> 4 int main() 5 { 6 int x; 7 int y; 8 int counter=0; 9 WINDOW *new_window_ptr; 10 char a_lteer=‘a‘; 11 initscr(); 12 for(x=0;x<LINES-1;x++) 13 { 14 for(y=0;y<COLS-1;y++) 15 { 16 mvwaddch(stdscr,x,y,a_lteer); 17 if(a_lteer>‘z‘) 18 a_lteer=‘a‘; 19 a_lteer++; 20 } 21 } 22 23 24 //创建子窗口 25 new_window_ptr=subwin(stdscr,10,20,10,10); 26 scrollok(new_window_ptr,1); 27 touchwin(stdscr); //刷新之前对父窗口调用该函数 28 refresh(); 29 sleep(2); 30 31 //删除字窗口中的内容,如何数输出新的内容 32 werase(new_window_ptr); 33 mvwprintw(new_window_ptr,2,0,"%s","this window will now scroll"); 34 wrefresh(new_window_ptr); 35 sleep(2); 36 37 for(counter=1;counter<10;counter++){ 38 wprintw(new_window_ptr,"%s","this text is both wrapping and scrolling"); 39 wrefresh(new_window_ptr); 40 sleep(2); 41 } 42 43 delwin(new_window_ptr); 44 touchwin(stdscr); 45 refresh(); 46 sleep(2); 47 endwin(); 48 exit(EXIT_SUCCESS); 49 }
标签:style blog color ar 使用 sp for div art
原文地址:http://www.cnblogs.com/newworldcom/p/4101612.html