MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / cf_WriteBytes

Function cf_WriteBytes

cfile/cfile.cpp:749–759  ·  view source on GitHub ↗

Writes the specified number of bytes from a file into the buffer DO NOT USE THIS TO WRITE STRUCTURES. This function is for byte data, such as a string or a bitmap of 8-bit pixels. Returns the number of bytes written. Throws an exception of type (cfile_error *) if the OS returns an error on write

Source from the content-addressed store, hash-verified

747// Returns the number of bytes written.
748// Throws an exception of type (cfile_error *) if the OS returns an error on write
749int cf_WriteBytes(const uint8_t *buf, int count, CFILE *cfp) {
750 int i;
751 if (!(cfp->flags & CFF_WRITING))
752 return 0;
753 ASSERT(count > 0);
754 i = fwrite(buf, 1, count, cfp->file);
755 cfp->position += i;
756 if (i != count)
757 ThrowCFileError(CFE_WRITING, cfp, strerror(errno));
758 return i;
759}
760// Writes a null-terminated string to a file. If the file is type binary,
761// the string is terminated in the file with a null. If the file is type
762// text, the string is terminated with a newline.

Callers 15

mng_ReplacePageFunction · 0.85
mng_DeletePageFunction · 0.85
SaveHeaderMethod · 0.85
WriteBlockMethod · 0.85
SaveGroupFunction · 0.85
cf_WriteStringFunction · 0.85
cf_WriteIntFunction · 0.85
cf_WriteShortFunction · 0.85
cf_WriteFloatFunction · 0.85
cf_WriteDoubleFunction · 0.85
cf_CopyFileFunction · 0.85
WriteAmbientDataFunction · 0.85

Calls 1

ThrowCFileErrorFunction · 0.85

Tested by

no test coverage detected