0

/*Can anybody help me .... there is a problem when i read from file in an array of objects ..
the error states that :

Debug assertion failed !
file : dbgheap.c
line :1017

Expression : _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

if i ask OS to ignore error it states another error i.e.
Debug Error !
DAMAGE : before (null) block at 0x01308910
*/

fstream out_air("air.txt", ios ::out | ios ::binary | ios ::in);
	if(!out_air)
	{
		cout<<"\nerror"<<endl;
		exit(1);

	}
	out_air.seekp(0);
	for(i=0;i<30;i++)
	out_air.write((const char*)&plane[i]),sizeof(CAircraft));
	cout<<"\nfile written"<<endl;
	out_air.clear();
//	out_air.close();
	system("pause");
	out_air.seekg(0);

	CAircraft me[30];
//	ifstream in_air("air.txt",ios:: in | ios ::binary);
	for(i=0;i<30;i++)
		out_air.read((char *)(&me[i]),sizeof(CAircraft));
        out_air.clear();
	out_air.close();

//now as main ends there occurs the error i.e. when the destructor //of fstream is called the error generates

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by NathanOliver
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.