C6329
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at C6329.
warning C6329: Return value for a call to <function> should not be checked against <number>
The program is comparing a number against the return value from a call to CreateFile. If CreateFile succeeds, it returns an open handle to the object. If it fails, it returns INVALID_HANDLE_VALUE.
This code could cause the warning:
if (CreateFile() == NULL) { return; }
This code corrects the error:
if (CreateFile() == INVALID_HANDLE_VALUE) { return; }
Show: