Hi!
I have an output of some files and I want to limit the number of lines of display to 5 lines. If I want to do this I need a scroll, right?
So, how to make a scroll in win32 console mode?
I'm writing in VC++ 6.0 on win98.
Thanks.
Printable View
Hi!
I have an output of some files and I want to limit the number of lines of display to 5 lines. If I want to do this I need a scroll, right?
So, how to make a scroll in win32 console mode?
I'm writing in VC++ 6.0 on win98.
Thanks.
The console window already has scrolling capability, but if you mean you only want five lines to be printed at a time then there are a few ways to do it. The simplest is to take five lines and print them, then wait for the user to ask for five more. A better trick is to create a little animation where you read one line and place it in an array, then print five lines. In the next iteration you move the index forward one element and print five more lines from there. With the proper sleep timing and screen clear, you can create a scrolling effect.
-Prelude
Hm...
Do you know how to write a code that will not allow user to exceed some X coordinate? Something like this:
Code:------------------------------
- user writes something, and -
- his text must not exceed -
- the border of this frame -
- -
- -
------------------------------
It would require some flavor of gotoxy, but you could keep two indexes. One would be the starting y coordinate and the other would be the ending y coordinate. Every time you print a newline, you increment a counter and if the counter equals the ending coordinate, reset the cursor to the starting position. This is assuming that no word wrap takes place, but that can be dealt with by keeping tabs on the x coordinates as well. :)
-Prelude