What is termios.TIOCGWINSZ

前端 未结 1 1993
小蘑菇
小蘑菇 2020-12-31 08:47

I want to get the size of the terminal. I am using this functionality:

import sys, struct, fcntl, termios

s = struct.pack(\'HHHH\', 0, 0, 0, 0)
t = fcntl.i         


        
1条回答
  •  天命终不由人
    2020-12-31 09:31

    It is a magic constant determined by the system you are running on resp. by the terminal driver.

    In combination with ioctl(), it serves to tell exectly what you want, in your case call IOCtl to Get the Window Size. Thus the name TIOCGWINSZ, IOCtl to Get the WINdow SiZe.

    This bit of documentation might help you clear things up.

    0 讨论(0)
提交回复
热议问题