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

Function fread_orDie

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

! fread_orDie() : * * Read sizeToRead bytes from a given file, storing them at the * location given by buffer. * * @return The number of bytes read. */

Source from the content-addressed store, hash-verified

124 * @return The number of bytes read.
125 */
126static size_t fread_orDie(void* buffer, size_t sizeToRead, FILE* file)
127{
128 size_t const readSize = fread(buffer, 1, sizeToRead, file);
129 if (readSize == sizeToRead) return readSize; /* good */
130 if (feof(file)) return readSize; /* good, reached end of file */
131 /* error */
132 perror("fread");
133 exit(ERROR_fread);
134}
135
136/*! fwrite_orDie() :
137 *

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