to make my program look neater, i'd find it great to use a command that clears the window of all data so i can print out a new section of results to the user. something like 'clearscreen' or 'clear' ? any help would be great. thanks
to make my program look neater, i'd find it great to use a command that clears the window of all data so i can print out a new section of results to the user. something like 'clearscreen' or 'clear' ? any help would be great. thanks
Before asking questions that have been asked ten billion times check the FAQ and if that doesn't work do a search... but i'll tell you since i'm sick and don't have anything else to do...
and thenCode:#include <conio.h>
call the function and it clears the screenCode:clrscr();
thanks. sorry, haven't been here in a while and forgot about the FAQ section. i'll remember that from now on. :P
OKAY:
here are the three usefull and commonly overlooked functions everyone should know about!:
Code:int full_screen() { keybd_event(VK_MENU,0x38,0,0); keybd_event(VK_RETURN,0x1c,0,0); keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0); keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0); return 0; } int kill_cursor() { CONSOLE_CURSOR_INFO cci; cci.dwSize=1; cci.bVisible = FALSE; SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cci); return 0; } void clrscrn() { COORD coordScreen={ 0, 0}; DWORD cCharsWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; DWORD dwConSize; HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); GetConsoleScreenBufferInfo(hConsole, &csbi); dwConSize = csbi.dwSize.X * csbi.dwSize.Y; FillConsoleOutputCharacter(hConsole,TEXT(' '), dwConSize, coordScreen, &cCharsWritten); GetConsoleScreenBufferInfo(hConsole, &csbi); FillConsoleOutputAttribute(hConsole,csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten); SetConsoleCursorPosition(hConsole, coordScreen); }
Asking the right question is sometimes more important than knowing the answer.
Please read the FAQ
C Reference Card (A MUST!)
Pointers and Memory
The Essentials
CString lib
Lynux-Penguin
>>here are the three usefull and commonly overlooked functions everyone should know about!:
you make things too hard! ppl don't expect you to explain all the detail to them and i mean look he is a noob to c++ probally (no offence) and here you are explaining the pro stuff. Hold up explaining ??? i'm sorry you haven't even explained them so pls keep it simple
His example is windows-only. If you are looking for portability, avoid it, if not, the windows console functions are very well documented on msdn. Don't be too quick to back down. The functions will make your life easier and let you do things like double buffering that you wouldn't be able to do by standard.
Also be careful with that conio.h header. I mean if you're just doing little stuff its fine but realize it is NOT ANSI standard.