It seems nobody here knows how to do this!!!
-
Sorry for the post name :-O! A week ago I posted a topic on clearing the screen in dos! Got four replies, none of which worked! Here is the problem. I have the folowing code inside main().
cout << " Hi! I am dumb."; cout << endl;
// Here I need the screen to clear the way BASIC used to clear it when you put cls() or something like that, cant remember now. // So that this next statment is printed on a clean dos screen!cout << " Hi! I am dumb."; cout << endl;
Some one suggested to cls() but didn't mention the header, then someone else said to use clrscr() and #include conio but conio does not have any members with such name. Even the docs supplied with VS 7 Ent. do not have any refference to cls() or anything even closely resembling it! If some one actualy does know how to do this PLEASE HELP! If somebody was offended by this post I aplgs! But some times you should take the time to read your own posts to see if they make sence or compile proper! Thanks in advance. -
Sorry for the post name :-O! A week ago I posted a topic on clearing the screen in dos! Got four replies, none of which worked! Here is the problem. I have the folowing code inside main().
cout << " Hi! I am dumb."; cout << endl;
// Here I need the screen to clear the way BASIC used to clear it when you put cls() or something like that, cant remember now. // So that this next statment is printed on a clean dos screen!cout << " Hi! I am dumb."; cout << endl;
Some one suggested to cls() but didn't mention the header, then someone else said to use clrscr() and #include conio but conio does not have any members with such name. Even the docs supplied with VS 7 Ent. do not have any refference to cls() or anything even closely resembling it! If some one actualy does know how to do this PLEASE HELP! If somebody was offended by this post I aplgs! But some times you should take the time to read your own posts to see if they make sence or compile proper! Thanks in advance.CreepingFeature wrote: Got four replies, none of which worked! Were any of them
FillConsoleOutputAttribute()
andFillConsoleOutputCharacter()
?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
-
CreepingFeature wrote: Got four replies, none of which worked! Were any of them
FillConsoleOutputAttribute()
andFillConsoleOutputCharacter()
?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
I think I replied to your question or was it someone else's?? dunno well you should use
system("cls");
it's fast, easy and painless. -
I think I replied to your question or was it someone else's?? dunno well you should use
system("cls");
it's fast, easy and painless.namethatnooneelsetook2 wrote: it's fast, easy and painless. It's also antiquated, inefficient, and reminiscent of Unix days. The
system()
function starts a complete command interpreter, which then executes the command. I cringe when I see solutions that have employed thesystem()
function. There is virtually nothing it can do that can't be done better by a direct API call. I consider it to have died with Win16 and is kept on for backward compatibility with old 16-bit programs that are being converted.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
-
CreepingFeature wrote: Got four replies, none of which worked! Were any of them
FillConsoleOutputAttribute()
andFillConsoleOutputCharacter()
?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
-
Sorry for the post name :-O! A week ago I posted a topic on clearing the screen in dos! Got four replies, none of which worked! Here is the problem. I have the folowing code inside main().
cout << " Hi! I am dumb."; cout << endl;
// Here I need the screen to clear the way BASIC used to clear it when you put cls() or something like that, cant remember now. // So that this next statment is printed on a clean dos screen!cout << " Hi! I am dumb."; cout << endl;
Some one suggested to cls() but didn't mention the header, then someone else said to use clrscr() and #include conio but conio does not have any members with such name. Even the docs supplied with VS 7 Ent. do not have any refference to cls() or anything even closely resembling it! If some one actualy does know how to do this PLEASE HELP! If somebody was offended by this post I aplgs! But some times you should take the time to read your own posts to see if they make sence or compile proper! Thanks in advance.Try this void ClearScreen() { HANDLE hSTDOut = GetStdHandle(STD_OUTPUT_HANDLE); COORD dwCoord; DWORD nLength; DWORD lpResult; CONSOLE_SCREEN_BUFFER_INFO Info; dwCoord.X = 0; dwCoord.Y = 0; // Get the console buffer info GetConsoleScreenBufferInfo( hSTDOut, &Info ); nLength = Info.dwSize.X * Info.dwSize.Y; // Fill the console with ' ' making it look like it has been cleared FillConsoleOutputCharacter( hSTDOut, ' ', nLength, dwCoord, &lpResult ); // Set the console cursor position to 0,0 SetConsoleCursorPosition( hSTDOut, dwCoord ); }
-
Those are what is used in Q99261. ;) __________________________________________ a two cent stamp short of going postal.
I see that. What's your point?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen