Share via


C6329

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

Example

This code could cause the warning:

if (CreateFile() == NULL)  
    {  
        return;  
    }  

Example

This code corrects the error:

if (CreateFile() == INVALID_HANDLE_VALUE)  
    {  
        return;  
    }