• Advertisement

Archived

This topic is now archived and is closed to further replies.

Console Applications in VC++

This topic is 6065 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When making a DOS bsed console application in VC++ is there a command to clear the screen? I want to make something like pong or even just a text base slot machine but I can''t seem to figure out how to clear the screen...in QBasic it''d be a simple Cls and in VB it would be sometime like cls or me.show/refesh how would I clear the screen in VC++ Console win32 app? thanks, ~~~~ sjunkim - P0et Liquid Ice Studios members.home.net/liquidicestudios/

Share this post


Link to post
Share on other sites
Advertisement
Hey dude its actually a very easy, yet little known trick.
You can use console commands or dos commands in your c/c++ console apps. To do this the syntax is: "system()"

so in order to clear the screen you would type the following:

system("cls");

or if you wanted to list all the directories on the c drive for instance you would type this:

system("c:\dir");

I hope that solves your problem

Cheers
Armed

Share this post


Link to post
Share on other sites
Thanks I''ll try that out, and is there anything similar to the Qbasic Sleep or VB WIN32 API SleepAPI command? (something that "freezes" the program for a short period of time,)


thanks,

Share this post


Link to post
Share on other sites
sjunkim: A console application under VC++ is not DOS, its as much a Win32 app as any windowed program. This means that if you #include windows.h, you can use the api call Sleep.

Share this post


Link to post
Share on other sites
Thanks so much for your help,


~~~~
sjunkim - P0et
Liquid Ice Studios
members.home.net/liquidicestudios/

Share this post


Link to post
Share on other sites

  • Advertisement