Reading A Full Line from a File

From ArcoWiki
Revision as of 16:21, 16 November 2018 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Is has been implemented, from version 3,6, the capability of reading a full line from a text file.
The command is a non-standard DMIS command to extend the File Handling capabilities.

See the code example:

$$ Example of Readln Command
DECL/CHAR,50,filnm,elnm
DECL/CHAR,100,read_str1,read_str2,read_str3
DECL/CHAR,100,write_str1,write_str2,write_str3

$$ This is to create a duumy file to be read.
write_str1=assign/'data1,1,2,3,4,5'
write_str2=assign/'data2,1,2,3,4,5'
write_str3=assign/'data3,1,2,3,4,5'

$$ This row opens the file as an output device.
TEXT/QUERY,(filnm),50,A,L,'insert file name'
filnm=ASSIGN/CONCAT('C:\',filnm,'.TXT')
DID(F1)=DEVICE/STOR,filnm
OPEN/DID(F1),DIRECT,OUTPUT,OVERWR
WRITE/DID(F1),write_str1
WRITE/DID(F1),write_str2
WRITE/DID(F1),write_str3
CLOSE/DID(F1)

$$ Read full line form from file
$$ Example of Read Line command
OPEN/DID(F1),DIRECT,INPUT
READ/DID(F1),read_str1
TEXT/OPER,read_str1
READ/DID(F1),read_str2
TEXT/OPER,read_str2
READ/DID(F1),read_str3
TEXT/OPER,read_str3

CLOSE/DID(F1)