Ignore:
Timestamp:
04/15/07 23:37:21 (18 years ago)
Author:
r2d
Message:

added a way to open a reader with an already open file (patch by DEATH)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/branches/r2d/libmpcdec/mpc_reader.c

    r196 r264  
    8888
    8989mpc_status
    90 mpc_reader_init_stdio(mpc_reader *p_reader, const char *filename)
     90mpc_reader_init_stdio_stream(mpc_reader * p_reader, FILE * p_file)
    9191{
    9292    mpc_reader tmp_reader; mpc_reader_stdio *p_stdio; int err;
     
    9999
    100100    p_stdio->magic  = STDIO_MAGIC;
    101     p_stdio->p_file = fopen(filename, "rb");
    102     if(!p_stdio->p_file) goto clean;
     101    p_stdio->p_file = p_file;
    103102    p_stdio->is_seekable = MPC_TRUE;
    104103    err = fseek(p_stdio->p_file, 0, SEEK_END);
     
    126125}
    127126
     127mpc_status
     128mpc_reader_init_stdio(mpc_reader *p_reader, const char *filename)
     129{
     130        FILE * stream = fopen(filename, "rb");
     131        if (stream == NULL) return MPC_STATUS_FILE;
     132        return mpc_reader_init_stdio_stream(p_reader,stream);
     133}
     134
    128135void
    129136mpc_reader_exit_stdio(mpc_reader *p_reader)
Note: See TracChangeset for help on using the changeset viewer.