#include <string.h>
+#ifdef _WIN32
+#include <fcntl.h>
+#include <io.h>
+#endif
+
#include "pickle.hpp"
#include "cli.hpp"
return 1;
}
}
-
+
+#ifdef _WIN32
+ // Set stdout in binary mode
+ fflush(stdout);
+ int mode = _setmode(_fileno(stdout), _O_BINARY);
+ if (mode == -1) {
+ std::cerr << "warning: failed to set stdout in binary mode\n";
+ }
+#endif
for (; i < argc; ++i) {
trace::Parser parser;
}
}
+#ifdef _WIN32
+ std::cout.flush();
+ fflush(stdout);
+ if (mode != -1) {
+ _setmode(_fileno(stdout), mode);
+ }
+#endif
+
return 0;
}
if args:
optparser.error('unexpected arguments')
+ # Change stdin to binary mode
+ try:
+ import msvcrt
+ except ImportError:
+ pass
+ else:
+ import os
+ msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
+
calls = 0
startTime = time.time()
while True: