File input/output: Difference between revisions

m
→‎version 1: utilized better use of lower/uppercase names, added a comment.
(→‎{{header|REXX}}: deleted version 2 as it did not read the record into a variable (as per task requirement).)
m (→‎version 1: utilized better use of lower/uppercase names, added a comment.)
Line 2,103:
===version 1===
<lang rexx>/*REXX program to read a file and store the contents into an output file*/
ifidiFID = 'input.txt' /*name of the input file. */
ofidoFID = 'output.txt' /*name of the output file. */
call lineout ofidoFID,,1 /*insure output starts at line 1.*/
 
do while lines(ifidiFID)\==0 /*read records until finished. */
y = linein(ifidiFID) /*read a record intofrom input. a REXX var. */
call lineout ofidoFID,y /*write a record to output.nt. */
end /*while ···*/
/*stick a fork in it, we're done.*/</lang>
 
===version 2===
Note that this version is limited to files less than one million bytes (and/or possibly virtual memory).