By using function CanGetErrorString
, it is possible to convert error code to a character string for all functions.
The string used with the CanGetErrorString function can be up to 256 bytes.
Dim Ret As Integer
Dim ErrorRet As Integer
Dim Id As Short
Dim ErrorString As New StringBuilder("", 256)
Ret = CanInit( "CAN000" , Id )
ErrorRet = CanGetErrorString( Ret, ErrorString )
System.Diagnostics.Debug.WriteLine( "CanInit: " & ErrorString
)
Ret = CanExit( Id )
ErrorRet = CanGetErrorString( Ret , ErrorString )
System.Diagnostics.Debug.WriteLine( "CanExit: " & ErrorString
)
int Ret;
int ErrorRet;
short Id;
string ErrorString;
Ret = can.Init( "CAN000", out Id );
ErrorRet = can.GetErrorString( Ret , ErrorString );
System.Diagnostics.Debug.WriteLine( "CanInit: " + ErrorString
);
Ret = can.Exit( Id );
ErrorRet = can.GetErrorString( Ret , ErrorString );
System.Diagnostics.Debug.WriteLine( "CanExit: " + ErrorString
);
long Ret;
long ErrorRet;
short Id;
char ErrorString[256];
Ret = CanInit( "CAN000" , &Id );
ErrorRet = CanGetErrorString( Ret , ErrorString );
printf("CanInit: %s", ErrorString );
Ret = CanExit( Id );
ErrorRet = CanGetErrorString( Ret , ErrorString );
printf("CanExit: %s", ErrorString );