From fc9c8eed3d1b7f7608b8451c53b214e502f1b8f1 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 31 Dec 2014 16:44:46 +0100 Subject: Write to stdout in binary mode on Windows This fixes the output of newlines. --- src/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main.c b/src/main.c index b2027ee..e849b82 100644 --- a/src/main.c +++ b/src/main.c @@ -7,6 +7,11 @@ #include "debug.h" #include "bench.h" +#if defined(_WIN32) && !defined(__CYGWIN__) + #include + #include +#endif + typedef enum { FORMAT_NONE, FORMAT_HTML, @@ -58,6 +63,10 @@ int main(int argc, char *argv[]) writer_format writer = FORMAT_HTML; long options = CMARK_OPT_DEFAULT; +#if defined(_WIN32) && !defined(__CYGWIN__) + _setmode(_fileno(stdout), _O_BINARY); +#endif + parser = cmark_parser_new(); files = (int *)malloc(argc * sizeof(*files)); -- cgit v1.2.3