chiark / gitweb /
cin.get(buf,100,'\n') fails on blank lines nowadays, bah - use getline
authorian <ian>
Sun, 3 Apr 2005 14:15:15 +0000 (14:15 +0000)
committerian <ian>
Sun, 3 Apr 2005 14:15:15 +0000 (14:15 +0000)
main.cc

diff --git a/main.cc b/main.cc
index 947faca..fbacbfb 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -111,10 +111,9 @@ int main(int argc, char **argv) {
     if (x11) list->display(*x11);
     if (dualx11) list->display(*dualx11);
     for (;;) {
-      cin.get(buf,100,'\n');
-      char c;
-      if (!cin.get(c) || c!='\n') {
-        cerr << "error reading command input, giving up\n";
+      cin.getline(buf,sizeof(buf),'\n');
+      if (!cin.good()) {
+       cerr << "error reading command input, giving up\n";
         exit(1);
       }
       char *equals= strchr(buf,'=');