
Originally Posted by
wysota
The destructor will be called when the application exits. Try adding std::endl to your cout statement in the destructor.
I have used this also , but am not able to see it.
Another thing is , if am debugging using VC Editor ,the controll is not coming to DISTRUCTOR.
Then i tried to LOG the function detail in a file. But there also it is not wrting anything to file.
see the code...
MyClass::~ MyClass()
{
cout<<"\n ~MyClass() ..." <<std::endl;
QFile objFile_2
( LOG_FILE
);
{
stream << "\n Function Name : " << __FUNCTION__ ;
stream << " [ " << __LINE__ <<" ]" ;
stream << " [ " << __FILE__ <<" ]" ;
}
objFile_2.close();
qDebug()<<"\n ~MyClass() ...";
}
MyClass::~ MyClass()
{
cout<<"\n ~MyClass() ..." <<std::endl;
QFile objFile_2( LOG_FILE );
if ( objFile_2.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream stream( & objFile_2 );
stream << "\n Function Name : " << __FUNCTION__ ;
stream << " [ " << __LINE__ <<" ]" ;
stream << " [ " << __FILE__ <<" ]" ;
}
objFile_2.close();
qDebug()<<"\n ~MyClass() ...";
}
To copy to clipboard, switch view to plain text mode
Am i trying something wrong .. please correct me if so ..
Bookmarks