Plc programming – Lenze ETC Motion Control User Manual
Page 386
PLC programming
Library
FILE IO functions
8.8
8.8.3
l
386
EDSTCXN EN 2.0
8.8.3.7
SYSREADLINE
FUNCTION SYSREADLINE: DINT
VAR_INPUT
handle_di
: DINT;
(* File handle returned by SysOpenFile *)
buffer_p
: DINT;
(* Address of a buffer where the data are stored *)
maxlen_di
: DINT;
(* Buffer length in byte *)
END_VAR
The function is used for the reading of lines (in sequence) from a file
previously opened with SysOpenFile(). Reading takes place up to the line end
but with a maximum of maxlen_di characters. The is only terminated early
if less than maxlen_d characters were read. The line feed at the end of the
line is also read.
Return value: Actual number of read characters; 0 for file end or less than 0
for error (
¶ 391).
8.8.3.8
SYSWRITEFILE
FUNCTION SYSWRITEFILE: DINT
VAR_INPUT
handle_di
: DINT;
(* File handle returned by SysOpenFile *)
buffer_p
: DINT;
(* Address of a uffer *)
len_di
: DINT;
(* number of the characters to be written *)
END_VAR
The function is used to write blocks (in sequence) into a file previously
opened with SysOpenFile(). len_di characters will be written to the file. If an
error occurs during write, the file will be deleted and a value of less than 0
returend.
Return value: Number of data written, or less than 0 in case of error (
¶ 391).
handle_di
: DINT;
num_di
: DINT;
ret_di
: DINT;
buffer_s
: STRING(10) := ’Hello’;
handle_di
:= SYSOPENFILE(’test.dat’, O_WRONLY);
num_di
:= SYSWRITEFILE(handle_di, ADR(buffer_s), 5);
ret_di
:= SYSCLOSEFILE(handle_di);
Declaration
Description
Declaration
Description
Example