#### Sample code for EOF and EOL

The sample code below should be entered inside the Edit window's Command Mode, not inside the File I/O dialog box.

The following code opens test.txt and reads through the file. As long as the end of file hasn't been reached (designated with the code, WHILE/!EOF), PC-DMIS reads through the file character by character, assigning a character to V1.

If PC-DMIS reaches the end of a line in the file, PC-DMIS shows the last character on that line.

This repeats until PC-DMIS reaches the end of the file. PC-DMIS then shows the text "End of File Reached…".

FPTR=FILE/OPEN,D:\temp\test.txt,READ

WHILE/!EOF("FPTR")

V1=FILE/READ_CHARACTER,FPTR

IF/EOL("FPTR")

COMMENT/OPER,NO,"End of Line Reached. The last character is:"

,V1

END_IF/

END_WHILE/

COMMENT/OPER,NO,"End of File Reached..."