diff src/ov-fcn-inline.cc @ 8946:e7e928088e90

fix CRLF issues with text-mode reading in windows when loading ascii data
author Benjamin Lindner <lindnerb@users.sourceforge.net>
date Tue, 10 Mar 2009 01:01:50 -0400
parents eb63fbe60fab
children fca0dc2fb042
line wrap: on
line diff
--- a/src/ov-fcn-inline.cc	Mon Mar 09 17:13:58 2009 -0400
+++ b/src/ov-fcn-inline.cc	Tue Mar 10 01:01:50 2009 -0400
@@ -48,6 +48,7 @@
 #include "toplev.h"
 
 #include "byte-swap.h"
+#include "ls-ascii-helper.h"
 #include "ls-oct-ascii.h"
 #include "ls-hdf5.h"
 #include "ls-utils.h"
@@ -162,29 +163,19 @@
       if (nm == "0")
 	nm = "";
 
-      char c;
-      std::ostringstream buf;
+      skip_preceeding_newline (is);
 
-      // Skip preceeding newline(s)
-      while (is.get (c) && c == '\n')
-	/* do nothing */;
+      std::string buf;
 
       if (is)
 	{
-	  buf << c;
 
-	  // Get a line of text whitespace characters included, leaving
-	  // newline in the stream
-	  while (is.peek () != '\n')
-	    {
-	      is.get (c);
-	      if (! is)
-		break;
-	      buf << c;
-	    }
+	  // Get a line of text whitespace characters included,
+	  // leaving newline in the stream.
+	  buf = read_until_newline (is, true);
 	}
 
-      iftext = buf.str ();
+      iftext = buf;
 
       octave_fcn_inline tmp (iftext, ifargs, nm);
       fcn = tmp.fcn;