Mercurial > octave-nkf
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 Wed Aug 03 15:38:59 2011 -0700 +++ b/scripts/io/textscan.m Wed Aug 03 19:54:37 2011 -0400 @@ -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").';