[xiph-cvs] cvs commit: vorbis/examples chaining_example.c

Chris Wolf cwolf at xiph.org
Thu Sep 13 16:34:47 PDT 2001



cwolf       01/09/13 16:34:47

  Modified:    examples chaining_example.c
  Log:
  Conditional code for win32 environment.

Revision  Changes    Path
1.11      +13 -1     vorbis/examples/chaining_example.c

Index: chaining_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/chaining_example.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- chaining_example.c	2001/08/13 01:36:55	1.10
+++ chaining_example.c	2001/09/13 23:34:46	1.11
@@ -11,16 +11,28 @@
  ********************************************************************
 
  function: illustrate simple use of chained bitstream and vorbisfile.a
- last mod: $Id: chaining_example.c,v 1.10 2001/08/13 01:36:55 xiphmont Exp $
+ last mod: $Id: chaining_example.c,v 1.11 2001/09/13 23:34:46 cwolf Exp $
 
  ********************************************************************/
 
 #include <vorbis/codec.h>
 #include <vorbis/vorbisfile.h>
 
+#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
+#include <io.h>
+#include <fcntl.h>
+#endif
+
 int main(){
   OggVorbis_File ov;
   int i;
+
+#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
+  /* Beware the evil ifdef. We avoid these where we can, but this one we 
+     cannot. Don't add any more, you'll probably go to hell if you do. */
+  _setmode( _fileno( stdin ), _O_BINARY );
+  _setmode( _fileno( stdout ), _O_BINARY );
+#endif
 
   /* open the file/pipe on stdin */
   if(ov_open(stdin,&ov,NULL,-1)<0){

--- >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 'cvs-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 commits mailing list