To write to a file, you have to put the file's write attribute in the open call.