You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 10 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
The documentation for input needs to be improved.
The existing documentation reads as follows:
val input : in_channel -> string -> int -> int -> int
input chan buff ofs len attempts to read len characters from
channel chan, storing them in string buff, starting at character
number ofs. It returns the actual number of characters read,
between 0 and len (inclusive). A return value of 0 means that the
end of file was reached. A return value between 0 and len
exclusive means that no more characters were available at that
time; input must be called again to read the remaining
characters, if desired. Exception Invalid_argument "input" is
raised if ofs and len do not designate a valid substring of buff.
The key phrase is ``no more characters were available at that time.''
I interpreted this to mean if I read from an ordinary disk file, I
would be guaranteed to get as many characters as were available.
Boy, was I wrong. If I try to read 31 characters at offset 4092 from
a 120696-character file, I get only 4 characters. What a surprise!
I would prefer the following wording:
input chan buff ofs len reads up to len characters from channel
chan, storing them in string buff, starting at character number
ofs. It returns the actual number of characters read, between 0
and len (inclusive). A return value of 0 means that the end of
file was reached. A return value between 0 and len exclusive
means that the implementation did not find it convenient to
return len characters; input must be called again to read the
remaining characters, if desired. Exception Invalid_argument
"input" is raised if ofs and len do not designate a valid
substring of buff.
I would have used really_input, except I didn't find a way to figure
out how many characters were read before the end of file.
The text was updated successfully, but these errors were encountered:
Original bug ID: 10
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Norman Ramsey
Version:
OS:
Submission from: estephe.inria.fr (128.93.11.95)
Submitted by: xleroy
The documentation for input needs to be improved.
The existing documentation reads as follows:
val input : in_channel -> string -> int -> int -> int
The key phrase is ``no more characters were available at that time.''
I interpreted this to mean if I read from an ordinary disk file, I
would be guaranteed to get as many characters as were available.
Boy, was I wrong. If I try to read 31 characters at offset 4092 from
a 120696-character file, I get only 4 characters. What a surprise!
I would prefer the following wording:
I would have used really_input, except I didn't find a way to figure
out how many characters were read before the end of file.
The text was updated successfully, but these errors were encountered: