| 30 | |
| 31 | |
| 32 | bool cFile::Open(cString _fname, ios::openmode flags) |
| 33 | { |
| 34 | if (IsOpen()) Close(); // If a file is already open, clost it first. |
| 35 | fp.open(_fname, flags); // Open the new file. |
| 36 | |
| 37 | // Test if there was an error, and if so, try again! |
| 38 | if (fp.fail()) { |
| 39 | fp.clear(); |
| 40 | fp.open(_fname, flags); |
| 41 | } |
| 42 | |
| 43 | if (fp.fail()) return false; |
| 44 | |
| 45 | m_openmode = flags; |
| 46 | filename = _fname; |
| 47 | is_open = true; |
| 48 | |
| 49 | // Return true only if there were no problems... |
| 50 | return (fp.good() && !fp.fail()); |
| 51 | } |
| 52 | |
| 53 | bool cFile::Close() |
| 54 | { |
no outgoing calls
no test coverage detected