Using the ncurses library in Cygwin

Source: Internet
Author: User

First install the full package of Cygwin, the package has a size of 7GB or so

Then use this small example to test whether the success

#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;}

The compilation directives are:


You can see that the compilation was successful.

Using the ncurses library in Cygwin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.