|
|
|||
|
|
|
||
|
Posted by Guy Lecky-Thompson Sep 29, 2006 |
The discussions here at Suite sometimes throw up a question to which even I have to sit back and think about. Drawing a rectangle on the screen was one such question.
This, I told myself, is easy. I've done it in BASIC (in 1982), in C (in 1992), and in many other languages since. But, those wree for me. For fun.
This is telling someone else how to go about it.
So, I thought I'd be nice. Since the question mentioned words like 'void' I assumed that the person asking it wanted a C styled answer. Text was mentioned, so I immediately thought, being a Win32 programmer, of using a Console Window.
Then, I thought that maybe that was too specific and non-portable. So I went for a conio solution. Then I tried to compile it under a generic Unix and failed miserably.
That's when I discovered the curses library. Now, my C command line programming toolbox is one step closer to completion. I've also learned a thing or two about porting applications, and writing for potability.
As for the text rectangle that started it all...
Check out the How to draw a Box on the Screen in C article for the full solution.