|
在VC.net 2005中
我用OpenFile函数打开BITAMP文件,用_lread读取文件.然后设置 _lseek(file_handle,4,SEEK_SET)时候就出现
Debug Assertion Failed错误.我跟踪了一下发现进入
_int64 __cdecl _lseeki64 (
int fh,
__int64 pos,
int mthd
)
{
__int64 r = -1i64;
/* validate fh */
_CHECK_FH_CLEAR_OSSERR_RETURN( fh, EBADF, -1i64 );
_VALIDATE_CLEAR_OSSERR_RETURN((fh >= 0 && (unsigned)fh < (unsigned)_nhandle), EBADF, -1i64);
_VALIDATE_CLEAR_OSSERR_RETURN((_osfile(fh) & FOPEN), EBADF, -1i64);
_lock_fh(fh); /* lock file handle */
__try {
/* make sure the file is open (after locking) */
if ( _osfile(fh) & FOPEN )
r = _lseeki64_nolock( fh, pos, mthd ); /* seek */
else {
errno = EBADF;
_doserrno = 0; /* not OS error */
r = -1i64;
_ASSERTE(("Invalid file descriptor. File possibly closed by a different thread",0));
}
}
__finally {
_unlock_fh(fh); /* unlock file handle */
}
return( r );
}
这个函数出错.其中在_VALIDATE_CLEAR_OSSERR_RETURN((fh >= 0 && (unsigned)fh < (unsigned)_nhandle), EBADF, -1i64);
这里出现错误.其中fh的值为3980,但是_nhandle这里是32.怎样解决这个问题呢 |
|