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

Method open

DEVELOPER/core/BinaryFileStream.cpp:138–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

writeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected