SetLastError

SetLastError sets the last-error code for the calling thread.

Syntax

VOID SetLastError(
    DWORD ErrCode
);

Parameters

ErrCode

The last error code for the thread.

Return Values

This function does not return a value.

Remarks

Error codes are 32-bit values. (Bit 31 is the most significant bit.) Bit 29 is reserved for application-defined error codes; no RTAPI error code has this bit set. If you are defining an error code for your application, set this bit to indicate that the error code has been defined by your application and ensure that your error code does not conflict with any system-defined error codes.

Most functions provided in RTX call SetLastError when they fail. Function failure is typically indicated by a return value error code such as FALSE, NULL, 0XFFFFFFFF, or -1.

Applications can retrieve the value saved by this function by using GetLastError. The use of GetLastError is optional; an application can call it to find out the specific reason for a function failure.

The last error code is kept in thread local storage so that multiple threads do not overwrite each other's values.

Requirements

Library Rtx_Rtss.lib

See Also:

GetLastError

IntervalZero.com | Support | Give Feedback