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

Method open

SRC/handler/DataFileStream.cpp:154–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 4

setPrecisionMethod · 0.95
setFloatFieldMethod · 0.95
writeMethod · 0.95
DataFileStream.cppFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected