MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / WriteToFile

Method WriteToFile

src/Platform/OutputMemory.cpp:326–348  ·  view source on GitHub ↗

Write all the data to file, but don't release the buffers Returns true if successful

Source from the content-addressed store, hash-verified

324// Write all the data to file, but don't release the buffers
325// Returns true if successful
326bool OutputBuffer::WriteToFile(FileData& f) const noexcept
327{
328 bool endedInNewline = false;
329 const OutputBuffer *current = this;
330 do
331 {
332 if (current->dataLength != 0)
333 {
334 if (!f.Write(current->data, current->dataLength))
335 {
336 return false;
337 }
338 endedInNewline = current->data[current->dataLength - 1] == '\n';
339 }
340 current = current->Next();
341 } while (current != nullptr);
342
343 if (!endedInNewline)
344 {
345 return f.Write('\n');
346 }
347 return true;
348}
349
350#endif
351

Callers 1

LogMessageMethod · 0.45

Calls 2

WriteMethod · 0.60
NextMethod · 0.45

Tested by

no test coverage detected