Verified Commit 1168a29e authored by Ralph Giles's avatar Ralph Giles
Browse files

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's avatarMark Harris <mark.hsj@gmail.com>
parent 4d406367
......@@ -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));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment