none
Debug Assertion Failed! File:f:\dd\vctools\crt_bld\_self_x86\crt\src\flength.c RRS feed

答案

全部回复

  • 请在Debug模式下调试,打开call stack,看函数调用堆栈~

    Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.

    2013年3月29日 16:17
    版主
  • 在Assert对话框上选重试按钮

    断到代码里查看调用堆栈

    找到自己的代码再分析原因


    新浪微博http://weibo.com/xianglitian,欢迎围观

    2013年3月30日 1:37
  • 这个工程是从6.0转到2010的,6.0下能正常运行,这是不是转换导致的问题呢

    2013年5月27日 13:54
  • #include <cruntime.h>
    #include <stdio.h>
    #include <errno.h>
    #include <io.h>
    #include <internal.h>
    #include <msdos.h>
    #include <mtdll.h>
    #include <stddef.h>
    #include <stdlib.h>

    /***
    *long _filelength(filedes) - find length of a file
    *
    *Purpose:
    *       Returns the length in bytes of the specified file.
    *
    *Entry:
    *       int filedes - handle referring to file to find length of
    *
    *Exit:
    *       returns length of file in bytes
    *       returns -1L if fails
    *
    *Exceptions:
    *
    *******************************************************************************/

    long __cdecl _filelength (
            int filedes
            )
    {
            long length;
            long here;

            _CHECK_FH_CLEAR_OSSERR_RETURN( filedes, EBADF, -1L );
            _VALIDATE_CLEAR_OSSERR_RETURN((filedes >= 0 && (unsigned)filedes < (unsigned)_nhandle), EBADF, -1L);
            _VALIDATE_CLEAR_OSSERR_RETURN((_osfile(filedes) & FOPEN), EBADF, -1L);

            _lock_fh(filedes);
            __try {
                if ( _osfile(filedes) & FOPEN ) {
                                    /* Seek to end to get length of file. */
                                    if ( (here = _lseek_nolock(filedes, 0L, SEEK_CUR)) == -1L )
                                                    length = -1L;   /* return error */
                                    else {
                                                    length = _lseek_nolock(filedes, 0L, SEEK_END);
                                                    if ( here != length )
                                                                    _lseek_nolock(filedes, here, SEEK_SET);
                                    }
                }
                else {
                        errno = EBADF;
                        _doserrno = 0L;
                        length = -1L;
                        _ASSERTE(("Invalid file descriptor. File possibly closed by a different thread",0));
                }
            }
            __finally {
                    _unlock_fh(filedes);
            }

            return(length);
    }

    2013年5月27日 14:07