_TFOPEN returns invalid Pointer to FILE?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wan-Hi

    #1

    _TFOPEN returns invalid Pointer to FILE?

    Hello

    I write an app (with _UNICODE triggered) and want to retrieve a pointer to a
    file struct like this:


    //Let's open the file in binary mode for reading.
    FILE *f = _tfopen(pFilePa th, _T("rb"));
    if (f == NULL)
    return;
    ....


    But during runtime a memory access violation happens in some MS DLL. 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@0x1027c898 {_ptr=0x0000000 0 <Bad Ptr> _cnt=0 _base=0x0000000 0 <Bad Ptr>
    ....}
    f->_ptr=0x0000000 0 <Bad Ptr> char *
    f->_cnt=0 int
    f->_base=0x000000 00 <Bad Ptr> char *
    f->_flag=1 int
    f->_file=3 int
    f->_charbuf=0 int
    f->_bufsiz=0 int
    f->_tmpfname=0x00 000000 <Bad Ptr> char *


    Does anyone know how to solve this problem?

    Thanks.


    Wan-Hi
Working...