Mercurial > hg > octave-terminal
changeset 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 | 9e1b9ca119eb |
children | d6209c354667 |
files | scripts/io/textscan.m |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
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").';