| View previous topic :: View next topic |
| Author |
Message |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue Jul 31, 2007 8:29 pm Post subject: System("PAUSE") over cin.get(); |
|
|
well many many people in c++ use System("PAUSE") or w/e to halt there program until you press a key, heres why you shouldn't use it...
it only works on windows or dos
you have to link to another header (stdio.h) instead of a native iostream.h code
so use this function now, i like it more
cin.get();
this requires no more linking and doesnt call the OS
it waits until return is pressed then continues the program  _________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Tue Jul 31, 2007 8:42 pm Post subject: |
|
|
| _getch() best emulates system("PAUSE") because it returns after one keypress |
|
| Back to top |
|
 |
DeltaFlyer Grandmaster Cheater
Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Tue Jul 31, 2007 8:45 pm Post subject: Re: System("PAUSE") over cin.get(); |
|
|
| blankrider wrote: | | it only works on windows or dos |
Most likely you won't write a program for another platform, especially with all your love for Win32 API.
| blankrider wrote: | | you have to link to another header (stdio.h) instead of a native iostream.h code |
Stdio is the standard C header compared to iostream which is a C++ only header. _________________
Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for? |
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Tue Jul 31, 2007 9:03 pm Post subject: |
|
|
cin.get() ftw... _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue Jul 31, 2007 9:11 pm Post subject: |
|
|
it helps if you put
cin.ignore();
in the line before it, i was running into issues with it skipping cin.get() after i entered a value _________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Tue Jul 31, 2007 9:20 pm Post subject: |
|
|
i use cin.ignore() as well _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Wed Aug 01, 2007 7:45 am Post subject: |
|
|
system("pause") doesnt require stdio...... it only requires iostream....
system("pause>nul") is basically the same thing as _getch() but it requires stdlib.h
the rest are all good.... _________________
|
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Wed Aug 01, 2007 10:35 am Post subject: |
|
|
But using system(XXX); is not safe. _________________
|
|
| Back to top |
|
 |
|