如何在ncurses中获得正确大小的窗口 [英] how to get a correctly sized window in ncurses
问题描述
我正在尝试在Linux(Mint)上用C语言进行ncurses编程,并且遇到了一个奇怪的问题.我一直在获取窗口的第一行和最后一行具有错误的列数.例如,使用此代码可在StackOverflow上找到
I am trying out ncurses programming in C on Linux (Mint) and am having a strange problem. I keep getting windows with the wrong number of columns for the first and final lines. For example, with this code found on StackOverflow
#include <ncurses.h>
int main(){
initscr();
WINDOW * win = newwin(10,50,10,10);
box(win,0,0);
wrefresh(win);
wgetch(win);
endwin();
return 0;
}
我得到以下输出:
┌─┐
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└─┘
好像第一行和最后一行只有三列宽.如果我使用waddch向窗口添加文本,那么我也只能在顶部一行添加三个字符.
As if the first and final lines are only three columns wide. If I add text to the window, using waddch, I can only add three characters to the top line as well.
任何帮助将不胜感激,我在网络上找不到其他人遇到此问题的示例,但这并不是最简单的选择一个好的搜索字符串的方法.
Any help would be appreciated, I can't find examples of other people running into this issue on the web, but it's not the easiest thing to come up with a good search string for.
推荐答案
一年前在《 ncurses常见问题解答.
这篇关于如何在ncurses中获得正确大小的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!