MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / open

Method open

SRC/handler/BinaryFileStream.cpp:139–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139int
140BinaryFileStream::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
171int
172BinaryFileStream::close(void)

Callers 2

writeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected