Click or drag to resize

DosError Function (DWord)

X#
Return the last DOS error code associated with an activation of the runtime error block.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION DosError(
	nNewDosCode AS DWORD
) AS DWORD
Request Example View Source

Parameters

nNewDosCode
Type: DWord
A DOS error number that changes the value returned by DOSError(). You can use it, for example, to reset the error code when trying to preserve the environment in black-box modules or when trying to counteract the side-effects from other modules.

Return Value

Type: DWord
The number of the last DOS error.
If the failed operation has no associated DOS error, DOSError() returns 0.
Remarks
When a runtime error occurs and the operation has an associated DOS error, DOSError() is set to that error code.
This value is retained until another runtime error occurs or until you set the value of DOSError() by specifying the nNewDosCode argument. With file functions, FError() returns the same value as DOSError().
Examples
The following example displays the DOS error code as a string:
X#
1FUNCTION Start()
2    Dir AA:                        // Bad device
3    QOut(DOSErrString(DOSError()))    
4                                    // Path not found
See Also