CLOSE_FILE
Function Name |
CLOSE_FILE |
---|---|
Description |
Closes an open file or serial port. The CLOSE_FILE should be used after data has been written to a file or serial port. |
Arguments |
FILEID {UDINT} The FILEID is a number that identifies the file or port that is to be closed. For more information on the data types for the inputs and outputs, see Data Type Hierarchy. |
Returns |
Zero {UDINT} The CLOSE_FILE function returns zero. |
NOTE: You should only use the CLOSE_FILE function in ST Programs.
Example:
ST Program - CLOSE_FILE:
To use a CLOSE_FILE function in an ST program, you need to use this syntax:
- ClosePort := CLOSE_FILE(FILEID);
where ClosePort and FILEID are variables that are declared earlier in the ST program. The FILEID variable has to be a UDINT and identifies the file or port that is to be closed. The ClosePort variable is a UDINT and stores the zero that is returned by the CLOSE_FILE function.
For an example of the CLOSE_FILE function being used in an ST Program, refer to the example in WRITE_FILE.