[Vorbis] Why does ov_open fail? (Or why is the FILE struct empty?)

Wan-Hi online at wan-hi.de
Tue May 24 14:08:13 PDT 2005


Hello and thanks for your replies.

Sorry, I pasted the wrong code snippet on mistake. I did it the 
following way but always get an unhandled exception in apphelp.dll 
because of a memory access violation at position 0x00000010 (that's what 
the debugger tells me if I translated it correctly). The exception 
occurs within the operation calling stack initiated by ov_open.

    #ifndef _UNICODE
    #define _UNICODE                // App uses Unicode.
    #endif

    #ifndef VC_EXTRALEAN
    #define VC_EXTRALEAN            // Exclude rarely-used stuff from
    Win32 headers
    #endif
    ...
    //Let's open the file in binary mode for reading.
        FILE *f = _tfopen(pFilePath, _T("rb"));
        if (f == NULL)
        {
            data.valid = false;
            return;
        }

        // Let's initialize the OggVorbis_File.
        if(ov_open(f, &vf, NULL, 0) < 0)
        {
            fclose(f);
            data.valid = false;
            return;
        }

While debugging I recognized that the pointer to the FILE struct is 
valid, but the struct content is not somehow. This is what the debugger 
tells me:

    - f at 0x1027c898 {_ptr=0x00000000 <Bad Ptr> _cnt=0 _base=0x00000000
    <Bad Ptr> ...}
    f->_ptr=0x00000000 <Bad Ptr>        char *
    f->_cnt=0                                          int
    f->_base=0x00000000 <Bad Ptr>     char *
    f->_flag=1                                         int
    f->_file=3                                          int
    f->_charbuf=0                                    int
    f->_bufsiz=0                                        int
    f->_tmpfname=0x00000000 <Bad Ptr>    char *

Does anyone know what I do wrong?

Thanks.


Wan-Hi



Paul Martin wrote:

>On Tue, May 24, 2005 at 01:16:51AM +0200, Wan-Hi wrote:
>
>  
>
>>   if (_topen(pFilePath, _O_RDONLY | _O_BINARY) == -1)
>>    
>>
>
>You open a file, then throw away the handle.
>
>  
>
>>   if(ov_open(stdin, &vf, NULL, 0) < 0)
>>    
>>
>
>You try to open a Vorbis file from STDIN, which is probably not the file 
>you opened with _topen().
>
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/vorbis/attachments/20050524/87307775/attachment.htm


More information about the Vorbis mailing list