[vorbis] Getting started with vorbisfile_example.c (MS VC 6)
Monty
xiphmont at xiph.org
Thu Jun 27 17:15:52 PDT 2002
On Thu, Jun 27, 2002 at 01:24:17PM -0700, Craig Dickson wrote:
> Alan MacDonald wrote:
>
> > What makes it even more confusing is, what you are reading will mostly look
> > correct, except the carriage returns and line feeds are translated to DOS
> > mode with 'r'. 'rb' disables that translation. Maybe it might be worth it
> > to add a comment to the example files on how to use fopen in windows, even
> > though the examples use stdio and stdout, since this seems to come up often.
> >
> > Something along the lines of, "If you re-implement this example using
> > fopen() in a WIN32 environment make sure that you use "rb" or "wb" for your
> > access mode to avoid carriage return and line feed translation"
>
> Of course, using stdin and stdout doesn't evade the problem, it merely
> hides it, because stdin and stdout are in text mode by default and will
> mess up your Ogg stream just the same. You have to do this to fix it:
>
> #ifdef _WIN32
> #include <io.h>
> #endif
>
> int main(int argc, char** argv)
> {
> #ifdef _WIN32
> _setmode(_fileno(stdin), _O_BINARY);
> _setmode(_fileno(stdout), _O_BINARY);
> #endif
At least decoder_example.c has this code. I'll make sure the others do too.
Monty
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis
mailing list