Ignore:
Timestamp:
12/01/07 18:46:13 (16 years ago)
Author:
r2d
Message:

stdin/stdout set to binary under windows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/trunk/mpcdec/mpcdec.c

    r360 r364  
    4545#endif
    4646
     47#ifdef WIN32
     48# include <fcntl.h>
     49# include <io.h>
     50# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
     51#else
     52# define SET_BINARY_MODE(file)
     53#endif
     54
    4755#define MPCDEC_MAJOR 0
    4856#define MPCDEC_MINOR 9
     
    140148    }
    141149
    142         if (strcmp(argv[optind], "-") == 0)
     150        if (strcmp(argv[optind], "-") == 0) {
     151                SET_BINARY_MODE(stdin);
    143152                err = mpc_reader_init_stdio_stream(& reader, stdin);
    144         else
     153        } else
    145154                err = mpc_reader_init_stdio(&reader, argv[optind]);
    146155    if(err < 0) return !MPC_STATUS_OK;
     
    165174        wavo_fc.m_seek      = mpc_wav_output_seek;
    166175        wavo_fc.m_write     = mpc_wav_output_write;
    167             if (strcmp(argv[optind + 1], "-") == 0)
     176                if (strcmp(argv[optind + 1], "-") == 0) {
     177                        SET_BINARY_MODE(stdout);
    168178                    wavo_fc.m_user_data = stdout;
    169             else
     179                } else
    170180                        wavo_fc.m_user_data = fopen(argv[optind + 1], "wb");
    171181        if(!wavo_fc.m_user_data) return !MPC_STATUS_OK;
Note: See TracChangeset for help on using the changeset viewer.