From e664321cc638372592b7c53752f19ed33f6ac9ad Mon Sep 17 00:00:00 2001 From: Demetri Maltsiniotis Date: Wed, 7 Apr 2021 15:11:44 -0500 Subject: [PATCH] Adding call to _setmode for Windows only to specify binary stdout output piping. --- host/hackrf-tools/src/hackrf_sweep.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/host/hackrf-tools/src/hackrf_sweep.c b/host/hackrf-tools/src/hackrf_sweep.c index 1355a633..1854f162 100644 --- a/host/hackrf-tools/src/hackrf_sweep.c +++ b/host/hackrf-tools/src/hackrf_sweep.c @@ -584,6 +584,12 @@ int main(int argc, char** argv) { window[i] = (float) (0.5f * (1.0f - cos(2 * M_PI * i / (fftSize - 1)))); } +#ifdef _MSC_VER + if(binary_output) { + _setmode(_fileno(stdout), _O_BINARY); + } +#endif + result = hackrf_init(); if( result != HACKRF_SUCCESS ) { fprintf(stderr, "hackrf_init() failed: %s (%d)\n", hackrf_error_name(result), result);