有人可以逐行解释这个简短的C程序的作用以及如何运行它吗?

时间:2011-02-20 19:02:48

标签: c ncurses

#include<curses.h> //includes the curses library so it can be used in the function
main()
{ //opening main method
    int i; //declare int i
    initscr(); //creates a terminal of a specific type?
    noecho(); // turn off echoing 
    for (i=0; I <5; i++) //loops from 0 to 4
        getch(); //takes one character from the keyboard, I think ?
    endwin();
} //restores the terminal

我不确定这个简单的程序在做什么,似乎也无法运行它? 有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:3)

我认为你在寻找:

initscr(); //This method initialize the current and standard screen
noecho(); // turn off echoing 
for (i=0; i <5; i++) //loops from 0 to 4
getch(); //YES you thinks right, it takes one character from the keyboard.
endwin();  //The endwin() function restores the terminal, by flushing any output to the  terminal and moving the cursor to the first column of the last line of the screen.
相关问题