I'm wondering: is it possible to get the width of a line in the standard output? Not the std::cout.width()
or std::setw()
widths, but the actual maximum number of characters before the OS will wrap a line?
EDIT: just to inform, I'm currently using windows xp, though I'd really prefer a portable manner to do this (everything else is portable atm).
Not using standard C++. cout
does not necessary be bound to a console, in which the "width" would be meaningless.
Of course it is possible using some other libraries, e.g. ncurses
.
If you're using Linux, check Getting terminal width in C?; if you're using Windows, check Getting terminal size in c for windows?.