We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Original bug ID: 6531 Reporter: cfranch Assigned to: @gasche Status: closed (set by @xavierleroy on 2016-12-07T10:34:50Z) Resolution: fixed Priority: normal Severity: major Version: 4.02.0+beta1 / +rc1 Target version: 4.02.2+dev / +rc1 Category: standard library Monitored by: @hcarty
Hi, it looks like that module Scanf is no more compliant to its documentation:
[c]: reads a single character. To test the current input character without reading it, specify a null field width, i.e. use specification [%0c].
OCaml version 4.02.0
val ib : Scanf.Scanning.in_channel =
The correct result is 'f' for every call to function 'bscanf "%0c"'.
Thank you very much.
The text was updated successfully, but these errors were encountered:
Comment author: @gasche
Fixed in branch 4.02.
Sorry, something went wrong.
gasche
No branches or pull requests
Original bug ID: 6531
Reporter: cfranch
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2016-12-07T10:34:50Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.02.0+beta1 / +rc1
Target version: 4.02.2+dev / +rc1
Category: standard library
Monitored by: @hcarty
Bug description
Hi,
it looks like that module Scanf is no more compliant to its documentation:
[c]: reads a single character. To test the current input character without reading it, specify a null field width, i.e. use specification [%0c].
I did a test with the recent version of OCaml and I got the following wrong result.peek char of scanf consumes the char
let ib = Scanf.Scanning.from_string "foo";;
val ib : Scanf.Scanning.in_channel =
Scanf.bscanf ib "%0c" (fun c -> c);;
Scanf.bscanf ib "%0c" (fun c -> c);;
Scanf.bscanf ib "%0c" (fun c -> c);;
Scanf.bscanf ib "%0c" (fun c -> c);;
Exception: End_of_file.
The correct result is 'f' for every call to function 'bscanf "%0c"'.
Thank you very much.
The text was updated successfully, but these errors were encountered: