Mercurial > hg > octave-lyh
diff scripts/io/textscan.m @ 12916:5d0478a75618
textscan: Fix multiple accesses, bug #33876.
* textscan.m: correctly implement the repeated format.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Wed, 03 Aug 2011 19:54:37 -0400 |
parents | ac00ae83ea2e |
children | e81ddf9cacd5 |
line wrap: on
line diff
--- a/scripts/io/textscan.m +++ b/scripts/io/textscan.m @@ -162,9 +162,11 @@ str = tmp_str = ""; n = 0; ## FIXME: Can this be done without slow loop? - while (ischar (tmp_str) && n++ <= nlines) - str = strcat (str, tmp_str); + while (ischar (tmp_str) && n++ < nlines) tmp_str = fgets (fid); + if (ischar (tmp_str)) + str = strcat (str, tmp_str); + endif endwhile else str = fread (fid, "char=>char").';