- Code: Select all
Path p("C: mp est1example.txt"); // assume test1 doesn't exists
File f(p);
bool b = f.createFile(); // returns true
In fact, CreateFile (used in CreateFileImpl) does not return 0 if it fails, but -1 (INVALID_HANDLE_VALUE) so the test
- Code: Select all
// in FileImpl::createFileImpl
if(hFile) {
//...
return true;
}
will allways return true, consequently making the function allways succeed.
A patch would be :
[code]
// in FileImpl::createFileImpl
if(hFile != INVALID_HANDLE_VALUE) {
//...
return true;
}





