From 1168a29ecda217d5192c37ee8b993433f8c945c4 Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Sat, 30 May 2020 21:17:36 -0700 Subject: trivial_example: open raw pcm files in binary mode. The simple codec round-trip example file in the doc directory opens an input and output pcm file. It was working fine on POSIX systems, but not on Windows, which treats text files differently. This is confusing in a example, so it's better to add an explicit binary flag to the fopen() calls. This does nothing on unix-like systems, but should make the example work for developers on Windows. Thanks to Wavesonics who reported this on irc. Signed-off-by: Mark Harris --- doc/trivial_example.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/trivial_example.c b/doc/trivial_example.c index 047ca0a2..abeba1c2 100644 --- a/doc/trivial_example.c +++ b/doc/trivial_example.c @@ -85,7 +85,7 @@ int main(int argc, char **argv) return EXIT_FAILURE; } inFile = argv[1]; - fin = fopen(inFile, "r"); + fin = fopen(inFile, "rb"); if (fin==NULL) { fprintf(stderr, "failed to open input file: %s\n", strerror(errno)); @@ -101,7 +101,7 @@ int main(int argc, char **argv) return EXIT_FAILURE; } outFile = argv[2]; - fout = fopen(outFile, "w"); + fout = fopen(outFile, "wb"); if (fout==NULL) { fprintf(stderr, "failed to open output file: %s\n", strerror(errno)); -- cgit v1.2.1