Difference between revisions of "Reading A Full Line from a File"

From ArcoWiki
Jump to: navigation, search
 
Line 1: Line 1:
 +
Is has been implemented, from version 3,6, the capability of reading a full line from a text file.<br />
 +
The command is a ''non-standard'' [[DMIS]] command to extend the [[File Handling]] capabilities.<br />
 +
<br />
 +
See the code example:
 +
 +
<code>
 +
<span style="color: green; text-decoration: none;">$$ Example of Readln Command</span><br />
 +
DECL/CHAR,50,filnm,elnm<br />
 +
DECL/CHAR,100,read_str1,read_str2,read_str3<br />
 +
DECL/CHAR,100,write_str1,write_str2,write_str3<br />
 +
<br />
 +
<span style="color: green; text-decoration: none;">$$ This is to create a duumy file to be read.</span><br />
 +
write_str1=assign/'data1,1,2,3,4,5'<br />
 +
write_str2=assign/'data2,1,2,3,4,5'<br />
 +
write_str3=assign/'data3,1,2,3,4,5'<br />
 +
<br />
 +
<span style="color: green; text-decoration: none;">$$ This row opens the file as an output device.</span><br />
 +
TEXT/QUERY,(filnm),50,A,L,'insert file name'<br />
 +
filnm=ASSIGN/CONCAT('C:\',filnm,'.TXT')<br />
 +
DID(F1)=DEVICE/STOR,filnm<br />
 +
OPEN/DID(F1),DIRECT,OUTPUT,OVERWR<br />
 +
WRITE/DID(F1),write_str1<br />
 +
WRITE/DID(F1),write_str2<br />
 +
WRITE/DID(F1),write_str3<br />
 +
CLOSE/DID(F1)<br />
 +
<br />
 +
<span style="color: green; text-decoration: none;">$$ Read full line form from file</span><br />
 +
<span style="color: green; text-decoration: none;">$$ Example of Read Line command</span><br />
 +
OPEN/DID(F1),DIRECT,INPUT<br />
 +
READ/DID(F1),read_str1<br />
 +
TEXT/OPER,read_str1<br />
 +
READ/DID(F1),read_str2<br />
 +
TEXT/OPER,read_str2<br />
 +
READ/DID(F1),read_str3<br />
 +
TEXT/OPER,read_str3<br />
 +
 +
CLOSE/DID(F1)<br />
 +
</code>
  
 
[[it:Lettura di una linea completa da un file]]
 
[[it:Lettura di una linea completa da un file]]
Line 8: Line 46:
  
 
[[Category:Dmis_Tutorial]]
 
[[Category:Dmis_Tutorial]]
 +
[[Category:Help_On_Line]]
 
[[Category:ReadMe3.6]]
 
[[Category:ReadMe3.6]]

Latest revision as of 16:21, 16 November 2018

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)