为什么使用“ dialog_checklist”时,为什么会得到细分错误。来自linux's&quot diarog.h'&quot?

发布于 2025-01-21 07:32:10 字数 587 浏览 2 评论 0原文

我想从对话框 linux软件包中使用dialog.h库过错。我认为这与字符串列表有关(char **),但我找不到解决方案。

在第10行上的此代码中,发生错误:

#include <dialog.h>

int main() {
    int distro;
    char dist1[] = "Ubuntu";
    char dist2[] = "Gentoo";
    char *distros[2] = {dist1,dist2};
    init_dialog(stdin, stdout); // start dialog

    distro = dialog_checklist("Select Distro","Select One",0,0,0,2,distros,1);

    end_dialog(); // end dialog
}

Incase任何人都需要它:对话的人页面。H

I wanted to use the dialog.h library from the dialog Linux package but when I try to make a radiolist (checklist with flag parameter set to 1) it gives me a segmentation fault. I assume it has to do with the list of strings (char**) but I have been unable to find a fix for it.

In this code on line 10 the error occurs:

#include <dialog.h>

int main() {
    int distro;
    char dist1[] = "Ubuntu";
    char dist2[] = "Gentoo";
    char *distros[2] = {dist1,dist2};
    init_dialog(stdin, stdout); // start dialog

    distro = dialog_checklist("Select Distro","Select One",0,0,0,2,distros,1);

    end_dialog(); // end dialog
}

Incase anyone needs it: man page for dialog.h

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

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

发布评论

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

评论(1

影子是时光的心 2025-01-28 07:32:10

看来我读了错误的文档,该列表应该包含每个项目的{标签,项目,状态}。

It appears I read the documentation wrong, the list was supposed to contain {tag, item, status} for each item.

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