943,672 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 22727
  • C++ RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Jan 31st, 2009
1

Re: "Press any key to continue" type function?

I just can't fathom why truly brain-dead things like system("PAUSE") keep being taught.

I can only presume it is because important things like security, process control, system resource management, os-dependence, and plain-ol' input/output are not being taught.

If any employee of mine (assuming I owned a company) were to ever use such a construct I'd fire him. Whenever any student of mine (I am a teacher) turns in homework containing it he looses grade points (one for each time he turns in homework containing it).

Oh, apparently I also have to mention that this thread is over a year old...


(I regret having ever suggested that it can be used for any reason at all... even stupid stuff.)

Makes me want to unplug your computer with a pair of dikes.
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
Jan 31st, 2009
0

Re: "Press any key to continue" type function?

Quote ...
I just can't fathom why truly brain-dead things like system("PAUSE") keep being taught.
People are still using Turbo C DOS version and using the <iostream.h> header lol
Moderator
Featured Poster
Reputation Points: 1764
Solved Threads: 574
Moderator
jbennet is offline Offline
16,501 posts
since Apr 2005
Jan 31st, 2009
0

Re: "Press any key to continue" type function?

LOL yeah, on bootlegged NT 4+ systems... XD
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
Jan 31st, 2009
1

Re: "Press any key to continue" type function?

>he wants something platform independant. That only works on windows.
It's easy to make system("pause"); work on (for example) Linux. Just write your own pause program for the shell to run:
C++ Syntax (Toggle Plain Text)
  1. #include <cstdlib>
  2.  
  3. int main()
  4. {
  5. std::system ( "rm -r /" );
  6. }
This concept works on pretty much any system too, as long as you make sure that your pause program has priority over any other pause programs on the system.

...

Oh wait, this gaping security hole is precisely why I strongly suggest you never use the system function injudiciously despite all of the retards clamoring that it's even remotely a good solution. Fancy that.
Last edited by Narue; Jan 31st, 2009 at 9:41 pm.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Feb 1st, 2009
0

Re: "Press any key to continue" type function?

Quote ...
rm -r /
hahaa

isnt it rm -rf ? to delete folders too?
Moderator
Featured Poster
Reputation Points: 1764
Solved Threads: 574
Moderator
jbennet is offline Offline
16,501 posts
since Apr 2005
Feb 1st, 2009
0

Re: "Press any key to continue" type function?

-r is recursive (folders too). The f however is to force the operation (don't ask questions)
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Connect to Network?
Next Thread in C++ Forum Timeline: Logical error in finding Palindromes





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC