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

Method open

SRC/runtime/commands/utilities/BinaryFileStream.cpp:152–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 4

writeMethod · 0.95
stripOpenSeesXMLFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected