Check access to a file before opening it

Detect and handle file operation errors

Do not reference file handles after the file they have been associated with is closed

flush buffered file input

Avoid OS specific sytax for file paths