The following example demonstrates the usage of error code management functions:
BOOL DoSomething(void *Buffer, int Size) { /* Validate parameters */ if(Size < 0) { /* Failure */ stSetLastError(ERR_INVALID_PARAMETER); return FALSE; } /* Perform operation */ /* ... */ /* Success */ return TRUE; } /* ... */ /* Usage example: */ if(!DoSomething((void *) &Buffer[4], Size - 4)) { printf("DoSomething function failed, error code: %i\n", (int) stGetLastError()); return FALSE; } /* ... */