Terminal Width (10)

2 Name: dmpk2k!hinhT6kz2E : 2007-09-02 05:14 ID:Heaven

I don't know the answer.

It sounds like you're going to reinvent the wheel though. May I suggest using ncurses? Handling terminals manually is hell; don't go there.

5 Name: #!/usr/bin/anonymous : 2007-09-02 20:31 ID:Heaven

>>4
When you're doing terminal handling, using ncurses will eventually pay off. Generally when the alternative would turn out to be having a minor nervous breakdown.

Also, it's good practice which I'm assuming you're after here anyway (given that xxd piped to less or whatever generally does the trick as far as viewing is concerned). Ncurses doesn't exactly have the most obvious API around.

Anyway... you can't actually rely on the COLUMNS variable existing. Oh god, terminals in Unix-workalikes... just implementing your own terminal emulator is an exercise in bonking yourself in a very uncomfortable place.

This thread has been closed. You cannot post in this thread any longer.