Applies To:
  • CitectSCADA 3.xx, 4.xx, 5.xx

Summary:
When I use the Cicode FilePrint() function to print a text file to my printer, I receive the following hardware alarm: "Cicode General Overflow FileReadLn FilePrint" (error code 275). The file still prints correctly.

Solution:
This is a known issue for Citect versions 3.xx, 4.xx and 5.xx. The error occurs because the file doesn't end with a carriage return. A simple work-around solution is to copy/paste the following Cicode in a Cicode file in your project instead of calling the FilePrint command from the CITECT.CI Cicode file in the Include project:

INT
FUNCTION
!Example: PrintFile("PrinterDev", "C:\Citect\Data\MyReport.txt")
PrintFile(STRING sDeviceName, STRING sFileName)

    INT hFile;
    INT hDev;
    STRING sText;

    hDev = DevOpen(sDeviceName, 0);
    IF (hDev = -1) THEN
        ErrLog("Invalid Argument to FilePrint - 'DeviceName'");
        RETURN 261;     !File does NOT exist
    END

    hFile = FileOpen(sFileName, "r");
    IF (hFile = -1) THEN
        ErrLog("Invalid Argument to FilePrint - 'FileName'");
        DevClose(hDev);
        RETURN 261;     !File does NOT exist
    END

    ErrSet(1);        !Masks 'Overflow Error' (code 275)

    WHILE NOT FileEOF(hFile) DO
        sText = FileReadLn(hFile);
        DevWriteLn(hDev, sText);
        DevWriteLn(hDev, sText);
    END

    ErrSet(0);        !Enables error checking by Citect

    FileClose(hFile);
    DevClose(hDev);
    RETURN 0;
END

 

Keywords:
 

Attachments