diff src/file-io.cc @ 7078:405cf85b435c

[project @ 2007-10-30 14:04:59 by jwe]
author jwe
date Tue, 30 Oct 2007 14:05:00 +0000
parents a1dbe9d80eee
children 81bed50b9feb
line wrap: on
line diff
--- a/src/file-io.cc	Mon Oct 29 19:12:28 2007 +0000
+++ b/src/file-io.cc	Tue Oct 30 14:05:00 2007 +0000
@@ -144,7 +144,27 @@
 
       std::string mode = mode_arg;
 
-      size_t pos = mode.find ('z');
+      // 'W' and 'R' are accepted as 'w' and 'r', but we warn about
+      // them because Matlab says they perform "automatic flushing"
+      // but we don't know precisely what action that implies.
+
+      size_t pos = mode.find ('W');
+
+      if (pos != NPOS)
+	{
+	  warning ("fopen: treating mode \"W\" as equivalent to \"w\"");
+	  mode[pos] = 'w';
+	}
+
+      pos = mode.find ('R');
+
+      if (pos != NPOS)
+	{
+	  warning ("fopen: treating mode \"R\" as equivalent to \"r\"");
+	  mode[pos] = 'r';
+	}
+
+      pos = mode.find ('z');
 
       if (pos != NPOS)
 	{