N00b Question concearning DOS console apps in C++

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

Post Reply
dream_coder
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 34
Joined: Sat Mar 27, 2010 5:16 pm

N00b Question concearning DOS console apps in C++

Post by dream_coder »

Hey all I have just joined these forums. I am attempting a text based adventure game. I was just wondering if there was some sort of C++ command that will clear the screen in C++ in a DOS console app.
Image
Image
Image
User avatar
Milch
Chaos Rift Junior
Chaos Rift Junior
Posts: 241
Joined: Sat Jul 11, 2009 5:55 am
Programming Language of Choice: C++
Location: Austria, Vienna

Re: N00b Question concearning DOS console apps in C++

Post by Milch »

Hey and welcome!

Code: Select all

#include <windows.h>
system("cls");
Should do it!
Next time try to google it ;)
Follow me on twitter!
User avatar
MrDeathNote
ES Beta Backer
ES Beta Backer
Posts: 594
Joined: Sun Oct 11, 2009 9:57 am
Current Project: cocos2d-x project
Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
Programming Language of Choice: C/++
Location: Belfast, Ireland
Contact:

Re: N00b Question concearning DOS console apps in C++

Post by MrDeathNote »

Milch wrote:Hey and welcome!

Code: Select all

#include <windows.h>
system("cls");
Should do it!
Next time try to google it ;)
^This
http://www.youtube.com/user/MrDeathNote1988

Image
Image

"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
dream_coder
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 34
Joined: Sat Mar 27, 2010 5:16 pm

Re: N00b Question concearning DOS console apps in C++

Post by dream_coder »

Thanx for that. It works a treat. I will try gharder with google next time. :mrgreen:
Image
Image
Image
User avatar
ultimatedragoon69
Chaos Rift Regular
Chaos Rift Regular
Posts: 122
Joined: Tue Oct 28, 2008 1:57 pm
Current Project: Pangea's quest (text ~tile~ based rpg)
Favorite Gaming Platforms: Dreamcast, PC, playstation 1, Virtual Boy, Snes
Programming Language of Choice: c++
Contact:

Re: N00b Question concearning DOS console apps in C++

Post by ultimatedragoon69 »

if your on a mac you could also use clear, here's my clear screen functions->

Code: Select all

void EasySystem::cls()
{
     #ifdef WIN32
            system("CLS");
     #else
            system("clear");
     #endif
}
Post Reply