Cicode Programming Reference > Using Cicode Programming Standards > Debug Error Trapping > DebugMsg function

DebugMsg function

DebugMsg() internally calls the TraceMsg() function if the debug switch is on. The implementation of this function can be found in DEBUG.CI in the INCLUDE project. You can turn the debug switch on or off by doing any of the following:

For example:

INT
FUNCTION
FilePrint(STRING sDeviceName, STRING sFileName)

INT hFile;
INT hDev;
STRING Str1;

hDev = DevOpen(sDeviceName, 0);
IF (hDev = -1) THEN
DebugMsg("Invalid arg to FilePrint - 'DeviceName'");
RETURN 261; /* File does not exist */
END
hFile = FileOpen(sFileName, "r");
IF (hFile = -1) THEN
DebugMsg("Invalid arg to FilePrint - 'FileName'");
DevClose(hDev);
RETURN 261; /* File does not exist */
END
WHILE NOT FileEof(hFile) DO
Str1 = FileReadLn(hFile);
DevWriteLn(hDev, Str1);
END
FileClose(hFile);
DevClose(hDev);
RETURN 0;
END