| 47 | } |
| 48 | |
| 49 | int |
| 50 | StandardStream::setFile(const char *fileName, openMode mode, bool echo) |
| 51 | { |
| 52 | if (fileOpen == 1) { |
| 53 | theFile.close(); |
| 54 | fileOpen = 0; |
| 55 | } |
| 56 | |
| 57 | if (mode == OVERWRITE) |
| 58 | theFile.open(fileName, ios::out); |
| 59 | else |
| 60 | theFile.open(fileName, ios::out| ios::app); |
| 61 | |
| 62 | if (theFile.bad()) { |
| 63 | std::cerr << "WARNING - StandardStream::setFile()"; |
| 64 | std::cerr << " - could not open file " << fileName << std::endl; |
| 65 | |
| 66 | return -1; |
| 67 | } else |
| 68 | fileOpen = 1; |
| 69 | |
| 70 | echoApplication = echo; |
| 71 | |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | |
| 76 | int |