From a6297b8a2c24adc5aa6dcd03cdc766368cda898d Mon Sep 17 00:00:00 2001 From: srs5694 Date: Sun, 25 Mar 2012 16:13:16 -0400 Subject: Fix Ctrl+D problems; 0.8.4 release --- support.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'support.cc') diff --git a/support.cc b/support.cc index 0a311a6..9e1c799 100644 --- a/support.cc +++ b/support.cc @@ -38,8 +38,8 @@ string ReadString(void) { string inString; getline(cin, inString); - if (!cin) - cin.clear(); + if (!cin.good()) + exit(5); return inString; } // ReadString() @@ -56,6 +56,8 @@ int GetNumber(int low, int high, int def, const string & prompt) { do { cout << prompt; cin.getline(line, 255); + if (!cin.good()) + exit(5); num = sscanf(line, "%d", &response); if (num == 1) { // user provided a response if ((response < low) || (response > high)) @@ -100,6 +102,8 @@ uint64_t GetSectorNum(uint64_t low, uint64_t high, uint64_t def, uint64_t sSize, do { cout << prompt; cin.getline(line, 255); + if (!cin.good()) + exit(5); response = IeeeToInt(line, sSize, low, high, def); } while ((response < low) || (response > high)); return response; -- cgit v1.2.1