| View previous topic :: View next topic |
| Author |
Message |
TROLOLOLOLOLOLOLOLOLOLOLO Expert Cheater
Reputation: -1
Joined: 27 Dec 2009 Posts: 100
|
Posted: Sun Feb 28, 2010 5:53 pm Post subject: [C++] system(); calls - need other commands that do the same |
|
|
I've been told using system(); calls is bad practice, since I'm starting I don't want to develop a bad habit early. Can someone please tell me ways I can accomplish the following without using system(); calls, thanks!
system("TITLE");
system("PAUSE");
system("CLS"); |
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sun Feb 28, 2010 7:08 pm Post subject: |
|
|
SetConsoleTitle()
kbhit()/PeekConsoleInput()
GetConsoleScreenBufferInfo()/FillConsoleOutputCharacter()/FillConsoleOutputAttribute()/SetConsoleCursorPosition() |
|
| Back to top |
|
 |
TROLOLOLOLOLOLOLOLOLOLOLO Expert Cheater
Reputation: -1
Joined: 27 Dec 2009 Posts: 100
|
Posted: Mon Mar 01, 2010 8:08 pm Post subject: |
|
|
| Slugsnack wrote: | SetConsoleTitle()
kbhit()/PeekConsoleInput()
GetConsoleScreenBufferInfo()/FillConsoleOutputCharacter()/FillConsoleOutputAttribute()/SetConsoleCursorPosition() |
When I use any of those I get the following error:
| Code: | | error C3861: 'example function': identifier not found |
Do I need to import any other library to use them? |
|
| Back to top |
|
 |
samo502 Master Cheater
Reputation: 0
Joined: 14 Mar 2008 Posts: 342 Location: That place.
|
Posted: Tue Mar 02, 2010 12:58 am Post subject: |
|
|
| CometJack wrote: | | Slugsnack wrote: | SetConsoleTitle()
kbhit()/PeekConsoleInput()
GetConsoleScreenBufferInfo()/FillConsoleOutputCharacter()/FillConsoleOutputAttribute()/SetConsoleCursorPosition() |
When I use any of those I get the following error:
| Code: | | error C3861: 'example function': identifier not found |
Do I need to import any other library to use them? |
You need to include <windows.h>, example follows:
| Code: | #include <iostream>
#include <windows.h>
using namespace std;
int main(void)
{
SetConsoleTitle("Hello World");
cout << "Hello, world!" << endl;
PeekConsoleInput();
return 0;
} |
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Tue Mar 02, 2010 6:59 am Post subject: |
|
|
| btw when you are peeking the console input, you don't want to use it as how samo502 just did. you'd probably loop it, checking the lpNumberOfEventsRead parameter |
|
| Back to top |
|
 |
|