8000 Windows: Broken file output because of newline translation · Issue #1 · lhf/libschrift-show · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Windows: Broken file output because of newline translation #1
Closed
@tomolt

Description

@tomolt

Hi,

First off thank you for providing this demo program!

I've noticed that on Windows, it produces skewed images such as this one:
libschrift-show
This is because your demo writes binary pixel values to stdout, which typically contain some 0x0A (Line Feed) bytes here and there.
Because Windows uses CR LF newlines, and stdout is usually in text mode (think fopen(,"w"), as opposed to fopen(,"wb")),
these 0x0A bytes will be replaced by a 0x0D 0x0A (CR LF) sequence during fwrite().
Consider writing images to a file instead of to the console.
Alternatively, you could use something like setmode(fileno(stdout), O_BINARY) on Windows to force stdout into binary mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0