Friday, February 25, 2011

simple ncurses program

#include <ncurses.h>
using namespace std;
int main()
{
 initscr();
move(12,30);                                               //the location of the output
printw("First ncurses programe\n");              //output
getch();
endwin();
return 0;
}



The compilation of the above program....

g++ -o<the name that you want compile> <file name> -lncurses






Add caption

2 comments:

  1. instead of using:

    move(12,30);
    printw("First ncurses programe\n");

    You can use the following code instead:

    mvprintw(12, 30, "First ncurses programe\n");

    To save space and time, you should use the mvprintw(y, x, " text displayed");

    ---------------------------------------

    x and y are integer values (0~9)...

    y is the row
    x is the column

    ---------------------------------------

    Sincerely,

    Wilson


    wperez274@gmail.com

    ncurses games:

    http://programswithc.weebly.com

    ReplyDelete
  2. instead of using:

    move(12,30);
    printw("First ncurses programe\n");

    You can use the following code instead:

    mvprintw(12, 30, "First ncurses programe\n");

    To save space and time, you should use the mvprintw(y, x, " text displayed");

    ---------------------------------------

    x and y are integer values (0~9)...

    y is the row
    x is the column

    ---------------------------------------

    Sincerely,

    Wilson


    wperez274@gmail.com

    ncurses games:

    http://programswithc.weebly.com

    ReplyDelete