http://www.cs.bu.edu/teaching/c/file-io/ ref.