Thanks.  I'll try it out.

Dan

On Feb 19, 2008 11:03 AM, Florin Iucha <florin at iucha.net> wrote:
> On Tue, Feb 19, 2008 at 09:52:53AM -0600, Dan Armbrust wrote:
> > I have a program that is writing info out to the console - and I need
> > to know where to wrap the lines.
> >
> > How does one go about finding the width of a console on linux?  Or
> > (shudder) on windows?
>
> //--- cut here --- cut here --- cut here --- cut here --- cut here ---
>
> /*
>  * Compile me like this:
>  *     "cc -lncurses screen_size.c"
>  */
>
> #include <curses.h>
>
> int main(void)
> {
>    int bx, by, mx, my;
>
>    initscr();
>
>    getbegyx(stdscr, by, bx);
>    getmaxyx(stdscr, my, mx);
>
>    endwin();
>
>    printf("%d rows and %d columns\n", mx - bx, my - by);
>
>    return 0;
> }
>
> //--- cut here --- cut here --- cut here --- cut here --- cut here ---
>
> There is curses for windows, too.
>
> Cheers,
> florin
>
> --
> Bruce Schneier expects the Spanish Inquisition.
>       http://geekz.co.uk/schneierfacts/fact/163
>
> _______________________________________________
> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
> tclug-list at mn-linux.org
> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
>
>