I've read that one should use cin.get() instead of system("pause"). Why is that?
Azurea 0 Light Poster
Recommended Answers
Jump to Post
system("pause")
represents an unsafe programming practice. Not only is the argument to the system function non-portable (your code would work on Windows but not Linux, for example), someone could replace the "pause" program on the machine with a malicious program and use it to cause trouble. Spoofing a legitimate …
Jump to PostSpoofing a legitimate program is a common practice among malware
yeah, i heard about thinks like that. e.g people replacing "ls" in linux with a command to recurisvely delete all directories. Will teach you to run as root ;)
Jump to PostDo cin.get() twice. Read the FAQs and stickies for more info.
Jump to PostThanks, doing it twice does solve the problem. So under what circumstances would doing it once solve the problem? What's the difference? I checked FAQ and didn't find answer--if you could point out a source would appreciate it! just curious when to do it once and when to do it …
All 16 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Narue 5,707 Bad Cop Team Colleague
jbennet 1,618 Most Valuable Poster Team Colleague Featured Poster
Azurea 0 Light Poster
sgw 0 Junior Poster in Training
Azurea 0 Light Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
sgw 0 Junior Poster in Training
Dave Sinkula 2,398 long time no c Team Colleague
sgw 0 Junior Poster in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
sgw 0 Junior Poster in Training
Dave Sinkula 2,398 long time no c Team Colleague
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
ikbendeman 0 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.