Quote:
Originally Posted by
pogdorica
Ohhhh, itīs very good !!! It works very fine, but ..... i donīt undestand it. Never i have used 'printf' with that format.
printf's only doing what you'd expect it to, converting %d into digits and printing the rest literally:
ESC[8;25;80t where ESC is an ASCII 0x1b -- or as you'd do that in a C string, \x1b. xterm-compatible terminals understand that sequence as 'resize to 80 columns 25 rows'.
There's an equivalent command for 'report the number of columns and rows':
ESC[18t. This will cause the terminal itself to print
ESC[8;24;80t back to you(assuming your term's 80x24 that is). These escape sequences are how the 'resize' command works.
Of course, in hardcoding them you're abandoning all pretenses of portability. But then, you already did so when you insisted the terminal had to be able to resize itself
There's a gigantic list of the escape sequences xterm understands
here. The VT100 DEC-based sequences are going to be portable to most terminal programs, but only the xterm ones can do things like move and resize the window.