Nearly all of the available functions in the DSCUD API return a BYTE value upon completion. This value represents an error code that will inform you as to whether or not the function call was successful. You should always check if the result returns a DE_NONE value (signifying that no errors were reported), as the code below illustrates:
BYTE result; ERRPARAMS errparams; if ((result = dscInit(DSC_VERSION)) != DE_NONE) { dscGetLastError(&errparams); fprintf(stderr, "dscInit failed: %s (%s)\n", dscGetErrorString(result), errparams.errstring); return result; }
In this code snippet, the BYTE result of executing a particular driver function (dscInit() in this case) is stored and checked against the expected return value (DE_NONE). Anytime a function does not complete successfully, an error code other than DE_NONE will be generated, and the current API function will terminate. The function dscGetErrorString() provides a description of the error that occurred.
This page was last modified 00:16, 4 Feb 2004.
Copyright (c) 2004 Diamond Systems. All Rights Reserved.