I have a problem in getting screen size using "ioctl" function.
The following program returns the correct screen size if the term is
by "rlogin" but does return an error if term is by "telnet".
extern int errno;
struct winsize ws;
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) < 0)
printf("%d is the errno\n", errno);
printf("%d is the width\n", ws.ws_col);
printf("%d is the length\n", ws.ws_row);
The output for the above program from an "rlogin" window isQuote:}
90 is the width
58 is the length
The output from a "telnet" window is
22 is the errno
0 is the width
0 is the length
Could anybody educate me regarding this?
Also "stty" behaves differently from "rlogin" window and from a "telnet"
The command "stty rows 24" works Okay on an "rlogin" terminal
but, on a "telnet" terminal it gives the following error:
unknown mode: rows
Could anybody help me in this regard? Please send me email.