C++ clear screen
Ok, I am still learning and always will, but I don''t know how to clear the screen in a console app. If I had this
void menu(void)
{
cout << "Hello blah blah";
clrscr(); //is this correct or is their some other function?
// if so what library do I need?
}
If I remember right I thought that was C based?
Windows SUCKS! Deal with it!
if(windows crashes)
{
run linux
}
else
{
yea right!!
}
Clearing the screen totally depends on what library you are using, if you are using an ANSI compatible compiler with conio.h you can just do clrscr(); otherwise check your compilers library documentation.
And yes, Windows does suck and linux is far greater but I have to run windows for my job
-- FlySwat99
And yes, Windows does suck and linux is far greater but I have to run windows for my job
-- FlySwat99
-- FlySwat99
What compiler are you using? In Borland or DJGPP you can use clrscr (in conio.h). In MSVC, Console Mode is NOT DOS. So you can''t use that clear screen command. Here''s an example of clearing the screen in MSVC (this was written by Eric Tetz over at programmersheaven.com, I don''t use Console Mode, I make either Win32 in MSVC or DOS applications in Borland, not "Console Mode"):
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
http://www.gdarchive.net/druidgames/
|
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
http://www.gdarchive.net/druidgames/
I have actually never seen/used the "clrscr" function. I do it a different way. Issue a shell command
Here is an example:
Hope that helps! Let me know if you have problems, even though you shouldn''t
Hey Null and Void hehe
------------------------------
"I''m a decorated astronaut, I don''t make those kind of mistakes."
"Oh now wait a minute. Look I''ll show ya. I''ll enter the same calculations using what we like to call ''The Right Way''."
-Rem
Here is an example:
|
Hope that helps! Let me know if you have problems, even though you shouldn''t
Hey Null and Void hehe
------------------------------
"I''m a decorated astronaut, I don''t make those kind of mistakes."
"Oh now wait a minute. Look I''ll show ya. I''ll enter the same calculations using what we like to call ''The Right Way''."
-Rem
------------------------------"I'm a decorated astronaut, I don't make those kind of mistakes.""Oh now wait a minute. Look I'll show ya. I'll enter the same calculations using what we like to call 'The Right Way'."-RemZirem Software
March 08, 2001 04:39 PM
I am using MSVC++ 6.0 for now till this semester is over with at college. I will then go totally Linux. I also have an issue with my internal DSL modem not working in Linux only externals and from what I am seeing external is the only way to go in any OS. Anyway I the system() function and that works. It seems slow to clear the screen or maybe it just me?! I am running 900mhz Thunderbird 384megs of Ram. But could it be I am still in debug mode? Does code run slower in debug mode then it would in the release mode? Thanks for the help!
Windows SUCKS! Deal with it!
if(windows crashes)
{
run linux
}
else
{
yea right!!
}
Windows SUCKS! Deal with it!
if(windows crashes)
{
run linux
}
else
{
yea right!!
}
Also this may seem stupid but if I want to close the program down while in another function and not inside of main() is their anyway to do this? Dosen''t endif work?
Windows SUCKS! Deal with it!
if(windows crashes)
{
run linux
}
else
{
yea right!!
}
Windows SUCKS! Deal with it!
if(windows crashes)
{
run linux
}
else
{
yea right!!
}
Using system("cls") is much slower than DOS/Win32 API commands in all cases that I''ve seen them tested. It''s like using system("echo Hello") instead of printf("Hello").
In Windows you''d normally use SendMessage(hwnd,WM_CLOSE,0,0) or PostQuitMessage(0) to exit your program. In DOS (and maybe console mode) you can use exit(0) (which is in stdlib.h). I believe that it is a ANSI standard function, so it should be there .
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
http://www.gdarchive.net/druidgames/
In Windows you''d normally use SendMessage(hwnd,WM_CLOSE,0,0) or PostQuitMessage(0) to exit your program. In DOS (and maybe console mode) you can use exit(0) (which is in stdlib.h). I believe that it is a ANSI standard function, so it should be there .
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
http://www.gdarchive.net/druidgames/
Hey Null and Void thanks. The exit(0) works! Where do you learn about all of these functions at? I don''t see them in C++ manuals? If u don''t mind where you live? I live in South Dakota! I no it sucks but looking to be moving to Phoenix or Seattle soon as college is done. Then hope to get a real job! Thank GOD!
Windows SUCKS! Deal with it!
if(windows crashes)
{
run linux
}
else
{
yea right!!
}
Windows SUCKS! Deal with it!
if(windows crashes)
{
run linux
}
else
{
yea right!!
}
I have no idea where I learned about all of this stuff, I guess I just picked it up over time. I''ve been doing this (C/C++) for the last 6 years (since I was 10, you''ll notice most people here learned C/C++ as early or earlier than I did) . I live in Aurora, Colorado (part of Denver Metro, as in essentially part of Denver, heh).
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
http://www.gdarchive.net/druidgames/
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
http://www.gdarchive.net/druidgames/
Cool I learned some BASIC on my commodore c64 when I was around 9. But lost touch with programming till I got out of High School and decided I wanted to code games. So I picked up C++ but can''t seem to find a game library that works with MSVC++ 6.0. I just want to mess around with it so I get an idea of how things work. I would like it to port over to Linux though. Since that is where I will be going to after this May. I tried Allegro but it is for DJGPP. I don''t want to use that enviroment though. I want a windows based IDE and game library that works with it. I don''t want to learn win32 api at all. I am going to learn Linux so no sense in learning win32. Also I will be learning OpenGL. I am currently working with GLUT. Is GLUT for Linux also? Any ideas? Thanks.
Windows SUCKS! Deal with it!
if(windows crashes)
{
run linux
}
else
{
yea right!!
}
Windows SUCKS! Deal with it!
if(windows crashes)
{
run linux
}
else
{
yea right!!
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement