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
Here are the function calls for the already suggested environmental variable thing:
int lines = atoi(getenv("LINES")); int columns = atoi(getenv("COLUMNS"));