Jump to content

Read a file line by line: Difference between revisions

no edit summary
m (→‎{{header|Phix}}: added syntax colouring the hard way, phix/basics)
No edit summary
Line 1,200:
}</lang>
The File is managed by reference count, and it gets closed when it gets out of scope or it changes. The 'line' is a char[] (with newline), so if you need a string you have to idup it.
 
=={{header|DBL}}==
<lang DBL>;
; Read a file line by line for DBL version 4
;
RECORD
 
LINE, A100
 
PROC
;-----------------------------------------------
OPEN (1,I,"FILE.TXT") [ERR=NOFIL]
DO FOREVER
BEGIN
READS (1,LINE,EOF) [ERR=EREAD]
END
EOF, CLOSE 3
GOTO CLOS
 
;------------------------------------------------
NOFIL, ;Open error...do something
GOTO CLOS
 
EREAD, ;Read error...do something
GOTO CLOS
 
CLOS, STOP</lang>
 
=={{header|DCL}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.