follow the c semantics: 'r': read if file does not exist, fail file ptr to start 'w': write if file exists, destroy contents if file doesn't exist, create new 'a': append if file doesn't exist, create new file ptr to end