View Single Post
Old Nov 28th, 2005, 9:05 AM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
cin >> s_fileIn;
This is problematic advice. One might define s_fileIn to be a megabyte and reduce the probability of a crash, but it's better just to use an input method that constrains the number of characters that will be allowed. Something like "cin.get (inputBuffer, bufferSize);" would do nicely.

If you don't use error checking before you've learned about it, you're just new. If you don't use it AFTER you've learned about it, you're either lazy, a schlock coder, or just recalcitrant. Not a pretty picture, but there you have it .
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote