- Opening an existing file for writing ( "w") when in fact, the user wants to preserve the file, discards the contents of file without warning.
- Forgetting to open a file before attempting to reference it in a program is a logic error.
- opening a nonexistent file for reading is an error.
- Opening a file for reading or writing without having been granted the appropriate access rights to the file ( this is operating-system dependent) is an error.
- Opening a file for writing when no space is available is a runtime error.
- Opening a file in write mode ("w") when it should be opened in update mode ("r+") causes the contents of the file to be discarded.
More Informative Posts