I am doing a game and i need to refresh the screen to make it less messy, Can anyone teach me how to do plz?
simple -- redraw whatever it is that you want on the screen.
If your question wasn't already answered by Ancient Dragon, and you're using text, then try using system("cls"); this should work to clear the screen.
If you are doing a game, don't use system("cls"). Write it properly.
What OS are you using? Windows? Linux?
if you do use sytem("cls"); then you will have to put in time wasting loops or else you won't be able to see much because the system("cls") will clear it all before you get to see it. so in short use some time wasting loops in it if you do use system("cls");
Mr. Cool, what do you do when you have to run the program on a system that does not have the CLS operating system command?
Here at DaniWeb, we try to give help that doesn't rely on system-specific solutions. Solutions that can work for as many people as possible.
Unfortunately, clearing the screen is impossible to do without platform specificity.
mugenoid, let us know what OS you are using and we'll give you a good solution.
Mr. Cool, unless you are running on hardware as old or older than an AT, it is just way too fast to make coding no-op loops useful. Even then, it is a bad idea, as the OS can do better for just pausing long enough for the user to read the screen...
I agree with Duoas. If you want delays used timed functions like delay() or sleep() or whatever else.
If you are doing a txt game ... the screen can be cleared using clrscr() (conio.h)
If you want a proper screen under DOS, look up Mode13h on the net . You will need a compiler like DJGPP. It's kinda hard to get into that particular mode with std compilers these days .... you have to twiddle with the settings, or use a compiler with protected DOS memory management like DJGPP.
If you are under windows (any), and want to do the rasterization (draw yourself), you should checkout PixelToaster which gives you a frame buffer to play with just like Mode 13 h.
Once you have a frame buffer, you can pretty much do anything ... draw lines, circles , quads etc etc , for any kinda game. ^^
Later you should checkout OpenGL and DirectX.
So... whatcha making?
Tic Tac Toe?