MCPcopy Create free account
hub / github.com/F-Stack/f-stack / fwrite_orDie

Function fwrite_orDie

freebsd/contrib/zstd/examples/common.h:146–153  ·  view source on GitHub ↗

! fwrite_orDie() : * * Write sizeToWrite bytes to a file pointed to by file, obtaining * them from a location given by buffer. * * Note: This function will send an error to stderr and exit if it * cannot write data to the given file pointer. * * @return The number of bytes written. */

Source from the content-addressed store, hash-verified

144 * @return The number of bytes written.
145 */
146static size_t fwrite_orDie(const void* buffer, size_t sizeToWrite, FILE* file)
147{
148 size_t const writtenSize = fwrite(buffer, 1, sizeToWrite, file);
149 if (writtenSize == sizeToWrite) return sizeToWrite; /* good */
150 /* error */
151 perror("fwrite");
152 exit(ERROR_fwrite);
153}
154
155/*! malloc_orDie() :
156 * Allocate memory.

Callers 4

compressFile_orDieFunction · 0.85
compressFile_orDieFunction · 0.85
compressFile_orDieFunction · 0.85
decompressFile_orDieFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected