From 373a624badc4b6b280b9b7f951388530d8d9c9e3 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sat, 4 Jun 2016 02:29:26 +0300 Subject: [PATCH] simplegrep: open file in binary mode ("rb") Otherwise it hangs on binary files (platform MinGW). --- examples/simplegrep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/simplegrep.c b/examples/simplegrep.c index 9e392a8f..d6bd4b39 100644 --- a/examples/simplegrep.c +++ b/examples/simplegrep.c @@ -77,7 +77,7 @@ static int eventHandler(unsigned int id, unsigned long long from, * length with its length. Returns NULL on failure. */ static char *readInputData(const char *inputFN, unsigned int *length) { - FILE *f = fopen(inputFN, "r"); + FILE *f = fopen(inputFN, "rb"); if (!f) { fprintf(stderr, "ERROR: unable to open file \"%s\": %s\n", inputFN, strerror(errno));