Skip to content

Open file_reader on Windows in binary mode #3948

Closed
@cretz

Description

@cretz

By default, you can't use io::file_reader on Windows where the file has byte 26 in the file because it is not opened in binary mode. It sees 26 and assumes EOF (or ctrl-Z or something). I noticed mk_file_writer uses O_BINARY as a flag on Windows. Can the io::file_reader function be changed to use binary mode? (I think this is just changing "r" to "rb" in the fopen flags).

Ref: http://cygwin.com/faq-nochunks.html#faq.api.cr-lf (as linked to from the mingw FAQ about O_BINARY here: http://www.mingw.org/wiki/FAQ)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.O-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions