Skip to content

Use binary mode for file output

Clayton Smith requested to merge argilo/libao:fix-windows-file-output into master

File output does not work properly on Windows, at least under MinGW. This is because ao_open_file does not pass the b flag to fopen, and so the file is opened in text mode. A carriage return character is then inserted into the output file before each line feed character.

As noted here, applications can request binary mode by using the b flag:

https://cygwin.com/faq.html#faq.api.cr-lf

In POSIX operating systems, the b flag is ignored:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html

Therefore, it should be safe to add it here.

Merge request reports

Loading