examples/files/README.md
A program which shows the basic usage of the "files" package by reading the path of the file and its contents.
With a minimal Pony installation, in the same directory as this README file run ponyc. You should see content building the necessary packages, which ends with:
...
Generating
Reachability
Selector painting
Data prototypes
Data types
Function prototypes
Functions
Descriptors
Optimising
Writing ./files.o
Linking ./files
Once files has been compiled, in the same directory as this README file run ./files files.pony. You should see the absolute path of the files.pony source file, as well as its contents.
$ ./files files.pony
/home/ryan/dev/github.com/ponylang/ponyc/examples/files/files.pony
use "files"
actor Main
new create(env: Env) =>
...
else
try
env.out.print("Couldn't open " + env.args(1)?)
end
end
Modify the program to print the file contents with line numbers.
$ ./files files.pony
/home/ryan/dev/github.com/ponylang/ponyc/examples/files/files.pony
1 use "files"
2
3 actor Main
4 new create(env: Env) =>
...
16 else
17 try
18 env.out.print("Couldn't open " + env.args(1)?)
19 end
20 end