C++ Error handling during file operations
-> There are various errors occour while dealing with files-
1. A file which we are attempting to open for reading does not exist.
2. The file name used for a new file may Already exist.
3. we may attempt an invalid operation such as reading past the end of file.
4. There may not be any space in the disk for storing more data.
5. we may use an invalid file name.
6. we may attempt to perform an operation when the file is not opened for that purpose.
-> The class ios supports several member functions that can be used to read the status recorded in file stream.
1. eof() : Returns true (non zero) if end of file is encountered while reading, otherwise returns false (zero).
2. fail() : Returns true when an input or output operation has failed.
3. bad() : Returns true if an invalid operation is attempted.
4. good() : Returns true if no error has occured.
-> There are various errors occour while dealing with files-
1. A file which we are attempting to open for reading does not exist.
2. The file name used for a new file may Already exist.
3. we may attempt an invalid operation such as reading past the end of file.
4. There may not be any space in the disk for storing more data.
5. we may use an invalid file name.
6. we may attempt to perform an operation when the file is not opened for that purpose.
-> The class ios supports several member functions that can be used to read the status recorded in file stream.
1. eof() : Returns true (non zero) if end of file is encountered while reading, otherwise returns false (zero).
2. fail() : Returns true when an input or output operation has failed.
3. bad() : Returns true if an invalid operation is attempted.
4. good() : Returns true if no error has occured.