Преглед на файлове

rtl_sdr: set binary file mode on win32

Signed-off-by: Steve Markgraf <steve@steve-m.de>
Hoernchen преди 12 години
родител
ревизия
30cf1f3598
променени са 1 файла, в които са добавени 5 реда и са изтрити 0 реда
  1. 5 0
      src/rtl_sdr.c

+ 5 - 0
src/rtl_sdr.c

@@ -26,6 +26,8 @@
 #include <unistd.h>
 #include <unistd.h>
 #else
 #else
 #include <Windows.h>
 #include <Windows.h>
+#include <io.h>
+#include <fcntl.h>
 #include "getopt/getopt.h"
 #include "getopt/getopt.h"
 #endif
 #endif
 
 
@@ -231,6 +233,9 @@ int main(int argc, char **argv)
 
 
 	if(strcmp(filename, "-") == 0) { /* Write samples to stdout */
 	if(strcmp(filename, "-") == 0) { /* Write samples to stdout */
 		file = stdout;
 		file = stdout;
+#ifdef _WIN32
+		_setmode(_fileno(stdin), _O_BINARY);
+#endif
 	} else {
 	} else {
 		file = fopen(filename, "wb");
 		file = fopen(filename, "wb");
 		if (!file) {
 		if (!file) {