NCurses:新窗口未显示

huangapple go评论58阅读模式
英文:

NCurses: new window not showing up

问题

以下是您提供的代码的翻译部分:

我正在按照Dan Gookin所著的《程序员使用NCurses指南》中提供的示例创建第二个窗口。以下是代码:

#include <ncurses/ncurses.h>

int main()
{
    WINDOW* second_window;

    initscr();

    addstr("原始窗口,stdscr。\n");
    refresh();
    getch();

    second_window = newwin(0, 0, 0, 0);

    if (second_window == NULL)
    {
        addstr("无法创建新窗口...\n");
        endwin();
        return 1;
    }

    waddstr(second_window, "这是第二个窗口!!!\n");

    getch();
    wrefresh(second_window);
    endwin();

    return 0;
}
然而,没有出现新窗口,也没有出现任何错误。

请注意,我只翻译了代码部分,没有包含问题的回答。如果您需要进一步的帮助或有其他问题,请随时提出。

英文:

I'm following the example presented in the book "Programmer's Guide to NCurses" by Dan Gookin for creating a second window. Here's the code:

#include &lt;ncurses/ncurses.h&gt;

int main()
{
    WINDOW* second_window;

    initscr();

    addstr(&quot;Origian window, stdscr.\n&quot;);
    refresh();
    getch();

    second_window = newwin(0, 0, 0, 0);

    if(second_window = NULL)
    {
        addstr(&quot;Unable to create new window...\n&quot;);
        endwin();
        return 1;
    }

    waddstr(second_window, &quot;This is the second window!!!\n&quot;);

    getch();
    wrefresh(second_window);
    endwin();

    return 0;
}

However, no new window is showing up, and I'm not getting any error either.

答案1

得分: 0

我在比较中使用了“=”而不是“==”。

英文:

I have used "=" instead of "==" in a comparison.

huangapple
  • 本文由 发表于 2023年5月29日 02:24:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76352992.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定