Error values
Some functions are designed to perform an action and return a value based on that action, for example, sqrt
will return the square root of a number. Other functions perform more complex operations and use the return value to indicate whether the function was successful. There is no common convention about such error values, so if a function returns a simple integer there is no guarantee that the values one library uses have the same meaning as values returned from functions in another library. This means that you have to examine carefully the documentation for any library code that you use.
Windows does provide common error values, which can be found in the winerror.h
header file, and the functions in the Windows Software Development Kit (SDK) only return values in this file. If you write library code that will be used exclusively in Windows applications, consider using the error values in this file because you can use the Win32 FormatMessage
function to obtain a description...