Switched from using low-level file I/O system calls to the STDIO system calls.  Added test case code.