| 137 | } |
| 138 | |
| 139 | int |
| 140 | BinaryFileStream::open(void) |
| 141 | { |
| 142 | // check setFile has been called |
| 143 | if (fileName == 0) { |
| 144 | std::cerr << "BinaryFileStream::open(void) - no file name has been set\n"; |
| 145 | return -1; |
| 146 | } |
| 147 | |
| 148 | // if file already open, return |
| 149 | if (fileOpen == 1) { |
| 150 | return 0; |
| 151 | } |
| 152 | |
| 153 | if (theOpenMode == OVERWRITE) |
| 154 | theFile.open(fileName, ios::out | ios::binary); |
| 155 | else |
| 156 | theFile.open(fileName, ios::out | ios::app | ios::binary); |
| 157 | |
| 158 | theOpenMode = APPEND; |
| 159 | |
| 160 | if (theFile.bad()) { |
| 161 | std::cerr << "WARNING - BinaryFileStream::setFile()"; |
| 162 | std::cerr << " - could not open file " << fileName << std::endl; |
| 163 | fileOpen = 0; |
| 164 | return -1; |
| 165 | } else |
| 166 | fileOpen = 1; |
| 167 | |
| 168 | return 0; |
| 169 | } |
| 170 | |
| 171 | int |
| 172 | BinaryFileStream::close(void) |
no outgoing calls
no test coverage detected