mgetl : anomaly (regression)
Reported by Alain Lamy
testfiles_mgetl.zip (494 bytes, application/x-zip-compressed)
test files
BUG DESCRIPTION:
----------------
With Scilab 6.0.1 under Windows, "mgetl" cannot correctly read files created under unix.
(it worked with Scilab 6.0.0, and all previous versions of Scilab)
A file created under unix (with end of line characters = '\n') cannot be read correctly under Windows
when mgetl is used as shown below:
> fd = mopen(filename)
> mgetl(fd, 1)
> mclose(fd)
Yet, "mgetl" behaves correctly in some cases, for instance when called like this:
str = mgetl(filename);
ERROR LOG:
----------
none
incorrect function behaviour
HOW TO REPRODUCE THE BUG:
-------------------------
// TEST CODE
// => Use attached test files
function mgetl_test(fname)
f = mopen(fname);
for k = 1 : 10
line = mgetl(f, 1);
if (line == [])
break;
end
mprintf("%s\n", line);
end
mclose(f);
endfunction
// Execution under Windows
// -----------------------
// 1) Input file with Windows style EOL characters
// => OK
--> mgetl_test("testfile_windows.txt")
line 1
line 2
line 3
// 2) Input file with Unix style EOL characters
// => First character of all lines except first one disappear !!
--> mgetl_test("testfile_unix.txt")
line 1
ine 2
ine 3
OTHER INFORMATION:
------------------