MCPcopy Create free account
hub / github.com/boostorg/leaf / file_read

Function file_read

example/print_file/print_file_exceptions.cpp:189–198  ·  view source on GitHub ↗

Read size bytes from f into buf.

Source from the content-addressed store, hash-verified

187
188// Read size bytes from f into buf.
189void file_read( FILE & f, void * buf, std::size_t size )
190{
191 std::size_t n = fread(buf, 1, size, &f);
192
193 if( ferror(&f) )
194 leaf::throw_exception(read_error, leaf::e_errno{errno});
195
196 if( n != size )
197 leaf::throw_exception(eof_error);
198}

Callers 1

mainFunction · 0.70

Calls 1

throw_exceptionFunction · 0.70

Tested by

no test coverage detected