gpt4 book ai didi

c - "Debug assertion failed"错误

转载 作者:太空宇宙 更新时间:2023-11-04 03:46:58 25 4
gpt4 key购买 nike

存在调试断言失败错误。有人能找到探测器吗?

Debug Assertion Failed !

Program:..
File:fclose.c
Line:47

Expression:(stream!=Null)

我正在 visual studio 中调试代码。

部分代码如下:

int __cdecl fclose (
FILE *stream
)
{
int result = EOF;

_VALIDATE_RETURN((stream != NULL), EINVAL, EOF);

/* If stream is a string, simply clear flag and return EOF */
if (stream->_flag & _IOSTRG)
stream->_flag = 0; /* IS THIS REALLY NEEDED ??? */

/* Stream is a real file. */
else {
_lock_str(stream);
__try {
result = _fclose_nolock(stream);
}
__finally {
_unlock_str(stream);
}
}

return(result);
}

最佳答案

检查 fclose() 的调用者。不要向它提供 NULL FILE*

关于c - "Debug assertion failed"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23510565/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com