[cig-commits] r9309 - cs/benchmark/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Wed Feb 13 10:28:34 PST 2008


Author: luis
Date: 2008-02-13 10:28:34 -0800 (Wed, 13 Feb 2008)
New Revision: 9309

Modified:
   cs/benchmark/cigma/trunk/src/TextWriter.cpp
Log:
Changed TextWriter to use stdout if filename is empty


Modified: cs/benchmark/cigma/trunk/src/TextWriter.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/TextWriter.cpp	2008-02-13 18:28:32 UTC (rev 9308)
+++ cs/benchmark/cigma/trunk/src/TextWriter.cpp	2008-02-13 18:28:34 UTC (rev 9309)
@@ -17,8 +17,18 @@
 
 void cigma::TextWriter::open(std::string filename)
 {
-    fp = fopen(filename.c_str(), "w");
-    assert(fp != NULL);
+    fp = NULL;
+
+    if (filename != "")
+    {
+        fp = fopen(filename.c_str(), "w");
+    }
+    else
+    {
+        fp = stdout;
+    }
+
+    assert(fp != NULL); // XXX: use return value instead of assert
 }
 
 void cigma::TextWriter::close()



More information about the cig-commits mailing list