| 151 | } |
| 152 | |
| 153 | int |
| 154 | DataFileStreamAdd::open(void) |
| 155 | { |
| 156 | // check setFile has been called |
| 157 | if (fileName == 0) { |
| 158 | std::cerr << "DataFileStreamAdd::open(void) - no file name has been set\n"; |
| 159 | return -1; |
| 160 | } |
| 161 | |
| 162 | // if file already open, return |
| 163 | if (fileOpen == 1) { |
| 164 | return 0; |
| 165 | } |
| 166 | |
| 167 | if (theOpenMode == OVERWRITE) |
| 168 | theFile.open(fileName, ios::out); |
| 169 | else |
| 170 | theFile.open(fileName, ios::out| ios::app); |
| 171 | |
| 172 | theOpenMode = APPEND; |
| 173 | |
| 174 | if (theFile.bad()) { |
| 175 | std::cerr << "WARNING - DataFileStreamAdd::setFile()"; |
| 176 | std::cerr << " - could not open file " << fileName << std::endl; |
| 177 | fileOpen = 0; |
| 178 | return -1; |
| 179 | } else |
| 180 | fileOpen = 1; |
| 181 | |
| 182 | if (doScientific == true) |
| 183 | theFile << std::scientific; |
| 184 | |
| 185 | theFile << std::setprecision(thePrecision); |
| 186 | |
| 187 | return 0; |
| 188 | } |
| 189 | |
| 190 | int |
| 191 | DataFileStreamAdd::close(void) |
no outgoing calls
no test coverage detected