ウィンドウの境界の外で印刷しようとしているのではないかと思います。
特に、私はここでそれを推測します:
mvwprintw(results_scrn,num_rows_res,(num_col_res/2) - 2,"Close");
...num_rows_res
はresults_scrn
ウィンドウ内の行数ですが、これは有効な行座標の範囲がから0
までであることを意味しnum_rows_res - 1
ます。
ウィンドウの外に出ようとしてmove()
もwmove()
、カーソルは実際には移動しません。後続のprintw()
またwprintw()
はは前のカーソル位置に印刷されます。mvprintw()
またはを実行しようとするmvwprintw()
と、カーソルを移動しようとした時点で呼び出し全体が失敗するため、何も出力されません。
これが完全なデモンストレーションです(行と列stdscr
があるものに印刷するだけです):LINES
COLS
#include <stdio.h>
#include <curses.h>
int main(void)
{
int ch;
initscr();
noecho();
cbreak();
/* This succeeds: */
mvprintw(1, 1, ">>>");
/* This tries to move outside the window, and fails before printing: */
mvprintw(LINES, COLS / 2, "doesn't print at all");
/* This tries to move outside the window, and fails: */
move(LINES, COLS / 2);
/* This prints at the cursor (which hasn't successfully moved yet): */
printw("prints at current cursor");
/* This is inside the window, and works: */
mvprintw(LINES - 1, COLS / 2, "prints at bottom of screen");
refresh();
ch = getch();
endwin();
return 0;
}
(実際、関数は結果を返します。それをチェックすると、失敗した場合にあることがわかりますERR
。)