I\'ve been looking for a way to get the terminal width from within my C program. What I keep coming up with is something along the lines of:
#include
Assuming you are on Linux, I think you want to use the ncurses library instead. I am pretty sure the ttysize stuff you have is not in stdlib.