MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / write

Method write

src/Core/src/FileStream.cpp:176–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174 }
175
176 void FileStream::write(const void* buffer, size_t len)
177 {
178 if (_mode != StreamMode::write)
179 {
180 throw Exception::InvalidOperation("Can not write");
181 }
182 if (len == 0)
183 {
184 return;
185 }
186
187 const auto bytesWriten = writeFile(buffer, len, _file);
188 if (bytesWriten != len)
189 {
190 throw Exception::RuntimeError("Failed to write data");
191 }
192
193 _offset += bytesWriten;
194 _length = std::max(_length, _offset);
195 }
196}

Callers 4

generateFileFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
mainFunction · 0.45

Calls 1

writeFileFunction · 0.85

Tested by 3

generateFileFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36