错误提示: Debug Assertion Failed! Program:... File:fclose.c Expression: (stream!=NULL)
2013-04-13 10:04
711 查看
近段时间用VC编程序,代码运行正确,但总是到最后的时候弹出如下错误提示:
Debug Assertion Failed!
Program:...
File:fclose.c
Expression: (stream!=NULL)
上网查了很多资料,尝试了一个星期,最后加断点,才定位到错误的位置。
如错误提示所说:是因为关闭文件指针(fclose(f))时,f==null。因此才出错。
因此你只需要在关闭该指针之前加上:if (f!=null) fclose(f);
因为也许你前面是在某些条件成立的条件下才打开了f指针,因此该f指针并不总是打开的。
以前写程序也经常遇到这个问题,比如fclose.c,fopen.c,fseek.c等等。但总是自己在不知道情况下稀里糊涂的该问题就消失了。也就没有认真去研究。因此以后若遇到这些问题,就可以找到有 fclose.c,fopen.c,fseek.c等等的行前后加断点,定位到错误的位置,就可以将问题解决了。
Debug Assertion Failed!
Program:...
File:fclose.c
Expression: (stream!=NULL)
上网查了很多资料,尝试了一个星期,最后加断点,才定位到错误的位置。
如错误提示所说:是因为关闭文件指针(fclose(f))时,f==null。因此才出错。
因此你只需要在关闭该指针之前加上:if (f!=null) fclose(f);
因为也许你前面是在某些条件成立的条件下才打开了f指针,因此该f指针并不总是打开的。
以前写程序也经常遇到这个问题,比如fclose.c,fopen.c,fseek.c等等。但总是自己在不知道情况下稀里糊涂的该问题就消失了。也就没有认真去研究。因此以后若遇到这些问题,就可以找到有 fclose.c,fopen.c,fseek.c等等的行前后加断点,定位到错误的位置,就可以将问题解决了。
相关文章推荐
- Problem: 程序运行时,出现错误提示 Debug Assertion Failed! Program: d:\Program\Prg.exe File: f:\rtm\vctools\vc7libs\ship\atlmfc\include\afxwin1.inl Line: 24
- C 运行错误:debug assertion failed,stream!=null
- Debug Assertion Failed!错误 关于m_File.m_hFile != NULL 和m_File.m_hFile != CFile::hFileNull 问题
- Debug Assertion Failed!错误 关于m_File.m_hFile != NULL 和m_File.m_hFile != CFile::hFileNull 问题
- 关于 debug assertion failed, file:dlgdata.cpp,line"43 错误解析
- MFC学习笔记之VC++ Debug Assertion Failed! 错误(File: strex.cpp Line: 690)
- MFC程序出现“Debug Assertion Failed! File:afx.inl Line:177”错误
- MFC程序出现“Debug Assertion Failed! File:afx.inl Line:177”错误
- VS2013编译C语言遇到Debug Assertion Failed! Expression:(str!=NULL)
- 关于 debug assertion failed, file:dlgdata.cpp,line"44 错误收藏
- MFC学习笔记003之调试错误DebugAssertionFailed!File:afx.inl Line:157
- 调试错误 debug assertion failed; file:dlgdata.cpp; line 43 分析析
- Debug Assertion Failed! FIle:afxhtml.inl Line 57的错误的解决
- laravel框架中提示错误:file_put_contents(/): failed to open stream: Permission denied
- GID/GDI+ 的运行时错误 Debug Assertion Failed Expression m_hDC==0
- Debug Assertion Failed! FIle:afxhtml.inl Line 57的错误的解决
- debug assertion failed stream!=NULL
- Debug Assertion Failed! File: isctype.c Line: 56 Expression (unsigned) (c+1) <=256
- 【Debug Assertion Failed!Expression:_pFirstBlock == pHead vs2013编程错误】
- MFC程序出现“Debug Assertion Failed! File:dlgdata.cpp Line: 43 ”错误