From a6140194ff28bafbc4a2b5804c923c7e5aa52163 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 29 Aug 2014 19:16:54 -0700 Subject: [PATCH] ExUtilReadFromStdin: (windows) open stdin in bin mode fixes input/decode from stdin in the examples Change-Id: Ie8052da758a9ef64477501b709408236d258da82 --- examples/example_util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/example_util.c b/examples/example_util.c index 4443f83d..5e34f305 100644 --- a/examples/example_util.c +++ b/examples/example_util.c @@ -46,6 +46,8 @@ int ExUtilReadFromStdin(const uint8_t** data, size_t* data_size) { *data = NULL; *data_size = 0; + if (!ExUtilSetBinaryMode(stdin)) return 0; + while (!feof(stdin)) { // We double the buffer size each time and read as much as possible. const size_t extra_size = (max_size == 0) ? kBlockSize : max_size;