octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #57596] Should the "len" argument of "fgetl" a


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #57596] Should the "len" argument of "fgetl" and "fgets" mean bytes or characters
Date: Tue, 14 Jan 2020 04:38:51 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0

Follow-up Comment #2, bug #57596 (project octave):

At least for "fgets", we shouldn't remove the "len" argument or we would break
Matlab compatibility. [1]

The word "character" isn't used consistently throughout the manual. Sometimes
it might mean "character entity" (does that include character modifiers?),
sometimes "byte" and sometimes "one element of a vector or matrix of type
'char'".

If we changed how "len" is working right now, the following code snippet might
stop working:

str(1:len) = fgets(fid, len);


But that already might fail if the source is non-UTF-8 and a non-ASCII
character is read.

[1]: https://de.mathworks.com/help/matlab/ref/fgets.html

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57596>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]