File input/output: Difference between revisions
Content added Content deleted
(→{{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: | Line 2,103: | ||
===version 1=== |
===version 1=== |
||
<lang rexx>/*REXX program to read a file and store the contents into an output file*/ |
<lang rexx>/*REXX program to read a file and store the contents into an output file*/ |
||
iFID = 'input.txt' /*name of the input file. */ |
|||
oFID = 'output.txt' /*name of the output file. */ |
|||
call lineout |
call lineout oFID,,1 /*insure output starts at line 1.*/ |
||
do while lines( |
do while lines(iFID)\==0 /*read records until finished. */ |
||
y = linein( |
y = linein(iFID) /*read a record from input. */ |
||
call lineout |
call lineout oFID,y /*write a record to output. */ |
||
end |
end /*while ···*/ |
||
/*stick a fork in it, we're done.*/</lang> |
/*stick a fork in it, we're done.*/</lang> |
||
===version 2=== |
===version 2=== |
||
Note that this version is limited to files less than one million bytes (and/or possibly virtual memory). |
Note that this version is limited to files less than one million bytes (and/or possibly virtual memory). |