[Saga-devel] saga SVN commit 3376: /trunk/examples/misc/

amerzky at cct.lsu.edu amerzky at cct.lsu.edu
Sat Jan 24 09:25:34 CST 2009


User: amerzky
Date: 2009/01/24 09:25 AM

Modified:
 /trunk/examples/misc/
  aws.cpp

Log:
 work around getline() blocking

File Changes:

Directory: /trunk/examples/misc/
================================

File [modified]: aws.cpp
Delta lines: +8 -12
===================================================================
--- trunk/examples/misc/aws.cpp	2009-01-24 15:16:43 UTC (rev 3375)
+++ trunk/examples/misc/aws.cpp	2009-01-24 15:25:25 UTC (rev 3376)
@@ -10,22 +10,18 @@
 {
   saga::job::istream out = j.get_stdout ();
 
-  while ( true )
+  std::string line;
+
+  while ( ! out.fail () ) 
   {
-    char buffer[255];
+    char c;
 
-    // get stdout
-    out.read (buffer, sizeof (buffer));
+    out.read (&c, 1);
 
-    if ( out.gcount () > 0 )
-    {
-      std::cout << std::string (buffer, out.gcount ());
-    }
+    if ( out.fail () ) 
+      break; 
 
-    if ( out.fail () )
-    {
-      break;
-    }
+    std::cout << c;
   }
 
   return;



More information about the saga-devel mailing list