Selective file copy: Difference between revisions

→‎{{header|ALGOL 68}}: output to a file instead of stand out
(algol 68 sample added)
(→‎{{header|ALGOL 68}}: output to a file instead of stand out)
Line 22:
# failed to open the file #
print( ( "Unable to open """ + file name + """", newline ) )
ELIF FILE output file;
STRING output name = "output.txt";
open( output file, output name, stand out channel ) /= 0
THEN
# failed to open the otput file #
print( ( "Unable to open """ + output name + """", newline ) );
close( input file )
ELSE
# filefiles opened OK #
BOOL at eof := FALSE;
# set the EOF handler for the file #
Line 36 ⟶ 43:
);
WHILE INPUTRECORD in record;
getf( input file, ( input format, in record ) );
NOT at eof
DO
Line 44 ⟶ 51:
field c OF out record := field c OF in record;
field x OF out record := "XXXXX";
putf( standoutput outfile, ( output format, out record ) )
OD;
# close the file #
close( inputoutput file );
close( input file )
FI</lang>
 
3,032

edits