Cygwin中使用ncurses库

来源:互联网 发布:php php_self 编辑:程序博客网 时间:2024/05/21 11:17

首先安装Cygwin的完整包,这个包有7GB大小左右

之后使用这个小例子测试是否成功

#include <ncurses.h>#include <string>#include <vector>//#define DEBUG#ifdef DEBUG#include <iostream>#include <cstdio>#endifint main(void){    int x,y;    std::vector<std::string> msg;    msg.push_back("Hello Ncurses!");    msg.push_back("Please Enter Anykey to exit. . .");    std::vector<std::string>::iterator pa=msg.begin();#ifndef DEBUG    initscr();    curs_set(0);    noecho();    getmaxyx(stdscr,y,x);    //refresh();    //mvprintw(y/2,x/2-pa->size()/2,pa->c_str());    for(int i=0;pa!=msg.end();++pa,++i)        mvprintw(y/2+i,x/2-pa->size()/2,pa->c_str());    //refresh();    getch();    echo();    curs_set(1);    endwin();#else    printf("%s\n",(++pa)->c_str());    std::cout<<*pa<<std::endl;#endif    return 0;}

编译指令是:


可以看到编译成功了

0 0