Elaboradar  0.1

◆ fread()

bool radarelab::File::fread ( void *  buf,
size_t  size 
)

Performs a fread on the file, throwing an exception if anything goes wrong.

If the read failed because the end of file was reached, it returns false.

Definizione alla linea 109 del file utils.cpp.

110 {
111  if (::fread(buf, size, 1, fd) != 1)
112  {
113  if (feof(fd))
114  return false;
115 
116  string errmsg("read failed on ");
117  errmsg += fname;
118  errmsg += ": ";
119  errmsg += strerror(errno);
120  throw runtime_error(errmsg);
121  }
122  return true;
123 }
bool fread(void *buf, size_t size)
Performs a fread on the file, throwing an exception if anything goes wrong.
Definition: utils.cpp:109