Check access to a file before opening it

Detect and handle file operation errors

Do not use file handles after the file they refer to has been closed

Avoid OS specific syntax for file paths

Do not remove or rename open files

Open files with as few privileges as necessary

Validate path and filename parameters supplied to file functions