summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRalph Giles <giles@thaumas.net>2020-05-30 21:17:36 -0700
committerRalph Giles <giles@thaumas.net>2020-06-01 00:48:45 -0700
commit1168a29ecda217d5192c37ee8b993433f8c945c4 (patch)
tree77abc066b55d3d8737752dac263d6b9891107b01 /doc
parent4d40636748da8aefd2e17b18c6897199838af77f (diff)
downloadopus-1168a29ecda217d5192c37ee8b993433f8c945c4.tar.gz
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>
Diffstat (limited to 'doc')
-rw-r--r--doc/trivial_example.c4
1 files changed, 2 insertions, 2 deletions
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));