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

Method open

SRC/handler/DataFileStreamAdd.cpp:153–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153int
154DataFileStreamAdd::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
190int
191DataFileStreamAdd::close(void)

Callers 4

setPrecisionMethod · 0.95
setFloatFieldMethod · 0.95
writeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected