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

Method open

DEVELOPER/core/DataFileStream.cpp:152–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152int
153DataFileStream::open(void)
154{
155 // check setFile has been called
156 if (fileName == 0) {
157 std::cerr << "DataFileStream::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 == OVERWRITE)
167 theFile.open(fileName, ios::out);
168 else
169 theFile.open(fileName, ios::out| ios::app);
170
171 theOpenMode = APPEND;
172
173 if (theFile.bad()) {
174 std::cerr << "WARNING - DataFileStream::setFile()";
175 std::cerr << " - could not open file " << fileName << std::endl;
176 fileOpen = 0;
177 return -1;
178 } else
179 fileOpen = 1;
180
181 if (doScientific == true)
182 theFile << std::scientific;
183
184 theFile << std::setprecision(thePrecision);
185
186 return 0;
187}
188
189int
190DataFileStream::close(void)

Callers 5

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

Calls

no outgoing calls

Tested by

no test coverage detected