Read a file line by line: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: added syntax colouring the hard way, phix/basics)
No edit summary
Line 1,200: Line 1,200:
}</lang>
}</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.
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}}==
=={{header|DCL}}==