我想知道航站楼的大小。我正在使用这个功能:
import sys, struct, fcntl, termios
s = struct.pack('HHHH', 0, 0, 0, 0)
t = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, s)
print(struct.unpack('HHHH', t))但是termios.TIOCGWINSZ到底是什么呢?
发布于 2013-04-26 21:10:54
它是一个神奇的常量,由您正在运行的系统分别确定。由终端驱动程序。
与ioctl()结合使用,它可以准确地告诉您想要什么,在本例中,调用IOCtl来获取窗口大小。因此命名为TIOCGWINSZ,IOCtl to Get WINdow SiZe。
This bit of documentation可能会帮你把事情搞清楚。
https://stackoverflow.com/questions/16237137
复制相似问题