diff src/DLD-FUNCTIONS/dlmread.cc @ 12182:99b00a9a5147

dlmread: skip leading whitespace on each line
author John W. Eaton <jwe@octave.org>
date Thu, 27 Jan 2011 06:37:52 -0500
parents 12df7854fa7c
children 72c96de7a403
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/dlmread.cc	Thu Jan 27 06:16:50 2011 -0500
+++ b/src/DLD-FUNCTIONS/dlmread.cc	Thu Jan 27 06:37:52 2011 -0500
@@ -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 ();