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

Method open

SRC/handler/FileStream.cpp:131–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131int
132FileStream::open(void)
133{
134 // check setFile has been called
135 if (fileName == 0) {
136 std::cerr << "FileStream::open(void) - no file name has been set\n";
137 return -1;
138 }
139
140 // if file already open, return
141 if (fileOpen == 1) {
142 return 0;
143 }
144
145 if (sendSelfCount != 0) {
146 int fileNameLength = strlen(fileName);
147 sprintf(&fileName[fileNameLength],".%d",1);
148 }
149
150
151 if (theOpenMode == OVERWRITE)
152 theFile.open(fileName, ios::out);
153 else
154 theFile.open(fileName, ios::out| ios::app);
155
156 theOpenMode = APPEND;
157
158 if (theFile.bad()) {
159 std::cerr << "WARNING - FileStream::setFile()";
160 std::cerr << " - could not open file " << fileName << std::endl;
161 fileOpen = 0;
162 return -1;
163 } else
164 fileOpen = 1;
165
166
167 theFile << std::setprecision(filePrecision);
168
169 return 0;
170}
171
172int
173FileStream::close(void)

Callers 15

setFloatFieldMethod · 0.95
tagMethod · 0.95
attrMethod · 0.95
writeMethod · 0.95
append_productMethod · 0.45
local_terminal_initMethod · 0.45
mainFunction · 0.45
mainFunction · 0.45
testMethod · 0.45
createTableMethod · 0.45

Calls

no outgoing calls

Tested by 4

testMethod · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36