![]() |
|
#1
|
||||
|
||||
clrscr()- Alternatives?I hate to post something when the answer is probably already on the site, but I've been searching for a while and can't find the answer to this. I wrote a program to calculate the number of seconds left in high school:
CPP / C++ / C Code:
and I'm looking for an alternative to CPP / C++ / C Code:
By the way, when I started programming, it was in a 2d game language called Blitz Basic. What I remember from it was that there was a front and back buffer. Instead of writing directly to the front buffer, the current screen was written to the backbuffer, and then the backbuffer was "flipped," causing the frontbuffer to become the backbuffer and vice versa. This eliminated the flickering problem that you see here. Is there a simple way to do this in c++? Thank you. |
||||
|
#2
|
|||
|
|||
|
What the hell ? Flickering in console mode ?
That's the first time I hear about that. |
|
#3
|
||||
|
||||
|
Quote:
Quote:
This sounds like DOS days when you had control over the hardware. Not no more... __________________
During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence? |
|
#4
|
||||
|
||||
|
The flickering problem is from the screen being updated so many times constantly. But, oh well, it is readable, so I guess it's not that big of a deal. Thanks
__________________
Pursue everything! P.S. This is what you would get at some point in the alphabet with the removal of the Q and R. |
|
#5
|
||||
|
||||
|
I just pulled this out of the MSDN database:
CPP / C++ / C Code:
That is a function to clear the screen. However, in a program this small, it seems like that would be more trouble than it is worth. So I guess it's either Borland or system ("cls") for me. Oh well. __________________
Pursue everything! P.S. This is what you would get at some point in the alphabet with the removal of the Q and R. |
|
#6
|
|||
|
|||
|
Regarding the memory hog issue...
You might want to implement a sleep function that will wake every half-second or so and update the screen. Also, rather than continually updating the variable x so much (I'n not really sure why you did that) why not just have a while(1) or for ( ;; ). You could exit (if you ever wanted to) with a break statement. |
|
#7
|
||||
|
||||
|
I had tried the sleep function already, but that just made it flicker a lot more, for some odd reason (hey, we're not supposed to make sense out of these things, right?).
And as for the weird x loop, that's just because for some reason, the compiler wouldn't let me use while(1). I don't know if it didn't want me to have an infinite loop or what. Anyway, I'll probably just leave it like it is. Thanks though! __________________
Pursue everything! P.S. This is what you would get at some point in the alphabet with the removal of the Q and R. |
|
#8
|
||||
|
||||
|
Well, that's odd. It seems that if I put the Sleep function in one place (and only one place) that it solves both the flickering and memory problem. That's kind of weird, but I don't question it. Thanks.
__________________
Pursue everything! P.S. This is what you would get at some point in the alphabet with the removal of the Q and R. |
Recent GIDBlog
Once again, no time for hobbies by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Removing the " underline pointer?" and advance clrscr()? | leitz | C Programming Language | 7 | 14-Nov-2004 12:53 |
| equivalent of clrscr() on unix/linux?? | nkhambal | C Programming Language | 1 | 03-Sep-2004 17:53 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The