如何在C中将终端大小调整为20行? [英] how to make terminal resize to 20 lines in C?

查看:95
本文介绍了如何在C中将终端大小调整为20行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写基于ncurses的终端游戏.
我应该确保窗口尺寸合适.
运行该程序时如何调整终端窗口显示20行?
我认为应该使用一些C API.谢谢

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

推荐答案

您可以使用

   int resizeterm(int lines, int columns);

以ncurses正确调整终端的大小.

to properly resize the terminal in ncurses.

OP想要更改Terminal的字体,所以

The OP wants to change the font of Terminal so

实际上不可能使用ncurses来调整终端字体.这超出了ncurses的范围.但是,如果您使用的是Mac :-),这是事情变得不那么容易移植的地方,您可以编写一个帮助程序外壳脚本,该脚本为mac os x ...调用applescript.请看OSX:如何在Terminal.app中运行应用程序更改其窗口的字体大小?

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?

这篇关于如何在C中将终端大小调整为20行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆