ref: 1168a29ecda217d5192c37ee8b993433f8c945c4
parent: 4d40636748da8aefd2e17b18c6897199838af77f
author: Ralph Giles <giles@thaumas.net>
date: Sat May 30 17:17:36 EDT 2020
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 <mark.hsj@gmail.com>
--- a/doc/trivial_example.c
+++ b/doc/trivial_example.c
@@ -85,7 +85,7 @@
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 @@
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));