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

发布于 2024-10-18 10:22:27 字数 464 浏览 1 评论 0原文

#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

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

#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

I am not sure about what this simple program is doing, and cannot seem to run it either ?
Could someone please help me out here ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

影子的影子 2024-10-25 10:22:27

我想您正在寻找:

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.

I think you are looking for:

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文