# HG changeset patch # User Ben Abbott # Date 1312415677 14400 # Node ID 5d0478a75618b0765f3586d5a892a834fe130b6e # Parent 9e1b9ca119eb67518ccb0eb1fc26175085f0a0bb textscan: Fix multiple accesses, bug #33876. * textscan.m: correctly implement the repeated format. diff --git a/scripts/io/textscan.m b/scripts/io/textscan.m --- 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").';