调试断言失败 [英] Debug Assertion Failure
本文介绍了调试断言失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下功能使用mfc中的对话框执行打开和读取操作.我正在调试断言失败,并且我试图找出原因.请帮助我在实际问题所在的地方找到它.
Hi,
The following function performs open and read operation, using dialog box in mfc. i''m getting debug assertion failure , and i''m trying to figure it out. Please help me to find it where the actual problem is ...
void CBIOS_CustomizationDlg::OnBnClickedRomButton()
{
// TODO: Add your control notification handler code here
this->UpdateData();
unsigned char *rom_Buffer;
unsigned int num_bytes_read;
ULONGLONG bios_file_size;
unsigned char bytes;
CFile f;
LPCTSTR strFilter = L"ROM Files (*.rom)|*.rom|All Files (*.*)|*.*||";
LPCTSTR tet = L".rom";
CFileDialog FileDlg(TRUE, tet, NULL, 0, strFilter);
if( FileDlg.DoModal() == IDOK )
{
if( f.Open(FileDlg.GetFileName(), CFile::typeBinary) == FALSE )
return;
bios_file_size = f.GetLength();
rom_Buffer = (UCHAR *)(malloc((size_t)bios_file_size));
//CArchive ar(&f, CArchive::load);
num_bytes_read = f.Read( rom_Buffer, (UINT)bios_file_size);
/*for(UINT i=0; i <= (UINT)bios_file_size; i++){
bytes = *(rom_Buffer + i);
}*/
AfxMessageBox(num_bytes_read);
//ar.Close();
}
else
return;
f.Close();
this->UpdateData(FALSE);
free(rom_Buffer);
}
[edit]已添加代码块-OriginalGriff [/edit]
[edit]Code block added - OriginalGriff[/edit]
推荐答案
AfxMessageBox(num_bytes_read);
如果您阅读文档 [
If you read the documentation[^] you will notice that your call is incorrect. Unless num_bytes_read
just happens to match the id of one of your string resources.
这篇关于调试断言失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文