一个stream!=NULL 的问题 fclose.c 47

运行一段时间会出现如下错误提示:
Debug Assertion Failed!
Program:...
File:fseek.c
line:100
Expression: (stream!=NULL)

点Retry,箭头指向fseek.c中的
        _VALIDATE_RETURN( (stream != NULL), EINVAL, -1);
这一行

关闭窗口的时候会出现如下错误提示:
Debug Assertion Failed!
Program:...
File:fclose.c
line:47
Expression: (stream!=NULL)
...
点Retry,箭头指向fclose.c中的
        _VALIDATE_RETURN((stream != NULL), EINVAL, EOF);
这一行,
请问是哪里出问题了.


相关代码:
double temp,tpme[3];
int nRead = 0;


fopen_s(&File,"D:\A.PRN","rb"); 

 for (int i=0;i<1;i++)
 {
            fseek(File,1000*count,0); 
  
   nRead =fread (tpme,1,24,File);
if( nRead == 24 )
{
                             count++;
}
else
{
bEnd = TRUE;
fclose(File);
}

 }
解决办法:
fclose放到else外面去。

最多的情况下是关闭了一个空的文件流句柄

原文地址:https://www.cnblogs.com/pengkunfan/p/3828877.html