changeset 12262:b22c00315df5 release-3-4-x

dlmread: skip leading whitespace on each line
author John W. Eaton <jwe@octave.org>
date Thu, 27 Jan 2011 06:37:52 -0500
parents 1860ce6c30d0
children c626741871a0
files src/ChangeLog src/DLD-FUNCTIONS/dlmread.cc
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-27  John W. Eaton  <jwe@octave.org>
+
+	* DLD-FUNCTIONS/dlmread.cc (Fdlmread): Skip leading whitespace
+	on each line.
+
 2011-01-27  John W. Eaton  <jwe@octave.org>
 
 	* ov-struct.cc (octave_struct::subsasgn,
--- a/src/DLD-FUNCTIONS/dlmread.cc
+++ b/src/DLD-FUNCTIONS/dlmread.cc
@@ -342,8 +342,9 @@
 
           if (cmax == 0)
             {
-              // Try to estimate the number of columns.
-              size_t pos1 = 0;
+              // Try to estimate the number of columns.  Skip leading
+              // whitespace.
+              size_t pos1 = line.find_first_not_of (" \t");
               do
                 {
                   size_t pos2 = line.find_first_of (sep, pos1);
@@ -376,7 +377,8 @@
 
           r = (r > i + 1 ? r : i + 1);
           j = 0;
-          size_t pos1 = 0;
+          // Skip leading whitespace.
+          size_t pos1 = line.find_first_not_of (" \t");
           do
             {
               octave_quit ();