MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / write

Method write

engine/source/platformEmscripten/EmscriptenFileio.cpp:763–786  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Write to a file. The number of bytes to write is passed in size, the data is passed in src. The number of bytes written is available in bytesWritten if a non-Null pointer is provided. -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

761// pointer is provided.
762//-----------------------------------------------------------------------------
763File::Status File::write(U32 size, const char *src, U32 *bytesWritten)
764{
765 // JMQ: despite the U32 parameters, the maximum filesize supported by this
766 // function is probably the max value of S32, due to the unix syscall
767 // api.
768 AssertFatal(Closed != currentStatus, "File::write: file closed");
769 AssertFatal(NULL != handle, "File::write: invalid file handle");
770 AssertFatal(NULL != src, "File::write: NULL source pointer");
771 AssertFatal(true == hasCapability(FileWrite), "File::write: file lacks capability");
772 AssertWarn(0 != size, "File::write: size of zero");
773
774 if ((Ok != currentStatus && EOS != currentStatus) || 0 == size)
775 return currentStatus;
776 else
777 {
778 S32 numWritten = x86UNIXWrite(*((int *)handle), src, size);
779 if (numWritten < 0)
780 return setStatus();
781
782 if (bytesWritten)
783 *bytesWritten = static_cast<U32>(numWritten);
784 return currentStatus = Ok;
785 }
786}
787
788//-----------------------------------------------------------------------------
789// Self-explanatory. JMQ: No explanation needed. Move along. These aren't

Callers

nothing calls this directly

Calls 1

x86UNIXWriteFunction · 0.70

Tested by

no test coverage detected