Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
4.6.3
-
None
-
Debian Linux (Squeeze)
Description
It could be a good idea, to check if the FILE pointer is valid with fileno().
// Open file handle FILE* pFile = fopen( "/tmp/hugo.txt", "w+"); if( !pFile ) { printf( "Error while opening file!\n" ); return 7; } // Create QFile from file handle QSharedPointer<QFile> pSharedPointer(new QFile()); pSharedPointer->open( pFile, QIODevice::WriteOnly ); // close file handle fclose( pFile ); // try to allocate the memory, where FILE* pointer points to DoSomethingWhichAllocatesMemory(); // close QFile pSharedPointer->close();