From 15a7d9aceebe839c514bc88a9b713e46b87c5d0a Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Fri, 21 Oct 2011 22:19:37 +0200 Subject: [PATCH] kinect_upload_fw: fix reading the firmware file on Windows In MS Windows fread() behaves differently than on UNIX systems when reading binary files if we do not specify "b" in the mode when opening the file. Quoting FOPEN(3) man page: ... the 'b' is ignored on all POSIX conforming systems, including Linux. (Other systems may treat text files and binary files differently, and adding the 'b' may be a good idea if you do I/O to a binary file and expect that your program may be ported to non-UNIX environments.) --- kinect_upload_fw/kinect_upload_fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kinect_upload_fw/kinect_upload_fw.c b/kinect_upload_fw/kinect_upload_fw.c index 80be29b..e544df4 100644 --- a/kinect_upload_fw/kinect_upload_fw.c +++ b/kinect_upload_fw/kinect_upload_fw.c @@ -139,7 +139,7 @@ int main(int argc, char** argv) { filename = argv[1]; } - FILE* fw = fopen(filename, "r"); + FILE* fw = fopen(filename, "rb"); if (fw == NULL) { fprintf(stderr, "Failed to open %s: %s\n", filename, strerror(errno)); return errno; -- 2.1.4