Skip to content

Fixing rtl_sdr.exe output binary mode on Windows #130

@williamyang98

Description

@williamyang98

Issue: src/rtl_sdr.c doesn't set stdout to BINARY mode on windows.
This causes the output stream to be translated by Windows which causes:

  • Specific byte values/sequences are interpreted and malformed
  • The I/Q byte packing can fall out of sync due to removal/addition of bytes
  • Streams closes abruptly because a EOF text character was sent

Fix: Line 291 in src/rtl_sdr.c
-- _setmode(_fileno(stdin), _O_BINARY)
++ _setmode(_fileno(stdout), _O_BINARY)
Changing stdin to stdout will actually set stdout to BINARY mode.

Relevant documentation:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/translation-mode-constants?view=msvc-170

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions