Accessing File Systems
Using the standard FS
and
File
interfaces, you can
create a portable directory listing (or "ls") command which works
across all platforms.
- If the program is passed no arguments it should list the files
in the current directory.
- If the command line contains a file name it should list the
file's name and length.
- If the command line contains a directory name, it should list
the files in the directory.
- Otherwise, the program warns that the command line
argument is unrecognized.
- The program handles all exceptions and does not crash.
It will also work without change on Unix or Win32 platforms!
See Main.m3 to see the code.