[TT #819] Add tests for exsec and hav opcodes
[parrot.git] / examples / tutorial / 40_file_ops.pir
blob7af9eda9e4b62b865477b1b5eb7f0a27d0e6d4fd
1 # Copyright (C) 2007-2009, Parrot Foundation.
2 # $Id$
4 =head1 File Operations
6 This example demonstrates basic file operations.
8 =cut
10 .sub main :main
11     .local pmc fileout, filein
13     fileout = open '40_file_ops_data.txt', 'w'
14     print fileout, "The quick brown fox jumps over the lazy dog.\n"
15     close fileout
17     filein = open '40_file_ops_data.txt', 'r'
18     $S0 = readline filein
19     say $S0
20     close filein
22     # Be nice and remove the temporary file we created.
23     $P1 = new ['OS']
24     $P1.'rm'('40_file_ops_data.txt')
25 .end
27 # Local Variables:
28 #   mode: pir
29 #   fill-column: 100
30 # End:
31 # vim: expandtab shiftwidth=4 ft=pir: