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

Function cf_WriteString

cfile/cfile.cpp:767–775  ·  view source on GitHub ↗

Writes a null-terminated string to a file. If the file is type binary, the string is terminated in the file with a null. If the file is type text, the string is terminated with a newline. Parameters: buf - pointer to the string cfp = the CFILE pointer 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

765// Returns the number of bytes written
766// Throws an exception of type (cfile_error *) if the OS returns an error on write
767int cf_WriteString(CFILE *cfp, const char *buf) {
768 int len;
769 len = strlen(buf);
770 if (len != 0) // write string
771 cf_WriteBytes((uint8_t *)buf, len, cfp);
772 // Terminate with newline (text file) or NULL (binary file)
773 cf_WriteByte(cfp, (cfp->flags & CFF_TEXT) ? '\n' : 0);
774 return len + 1;
775}
776
777// Just like stdio fprintf(), except works on a CFILE
778int cfprintf(CFILE *cfp, const char *format, ...) {

Callers 15

mng_WriteShipPageFunction · 0.85
mng_WriteNewShipPageFunction · 0.85
mng_WriteNewSoundPageFunction · 0.85
mng_WriteGamefilePageFunction · 0.85
mng_WriteNewGamefilePageFunction · 0.85
mng_WriteMegacellPageFunction · 0.85
mng_WriteNewMegacellPageFunction · 0.85
mng_WriteGenericPageFunction · 0.85
mng_WriteNewGenericPageFunction · 0.85
mng_WriteDoorPageFunction · 0.85
mng_WriteNewDoorPageFunction · 0.85
mng_WriteTexturePageFunction · 0.85

Calls 2

cf_WriteBytesFunction · 0.85
cf_WriteByteFunction · 0.85

Tested by

no test coverage detected