how to make terminal resize to 20 lines in C?

。_饼干妹妹 提交于 2020-01-05 13:56:08

问题


I'm writing a terminal game build on ncurses.
I should ensure the window in suitable size.
How to adjust terminal window display 20 lines when running the process?
I think it should be use some C API. Thanks


回答1:


You can use

   int resizeterm(int lines, int columns);

to properly resize the terminal in ncurses.

Edit

The OP wants to change the font of Terminal so

It's not really possible to adjust the terminal font using an ncurses. That's beyond the scope of ncurses. however if you're on mac :-) and this is where things become less portable, you can write a helper shell script that invokes applescript for mac os x ... .Have a look at OSX: How can an application running in Terminal.app change the font size of its window?



来源:https://stackoverflow.com/questions/49000659/how-to-make-terminal-resize-to-20-lines-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!