Elaboradar  0.1
 Tutto Classi Namespace File Funzioni Variabili Tipi enumerati (enum) Gruppi
bool radarelab::File::open ( const std::string &  fname,
const char *  mode,
const char *  desc = nullptr 
)

Opens a file by its pathname.

Returns false if anything fails.

Definizione alla linea 49 del file utils.cpp.

Referenziato da elaboradar::CalcoloVPR::analyse_VPR(), elaboradar::Assets::read_archived_vpr(), elaboradar::Assets::read_file_hray(), elaboradar::Assets::read_file_hray_inf(), e elaboradar::Assets::write_dbz_coefficients().

50 {
51  if (fd)
52  {
53  fclose(fd);
54  fd = nullptr;
55  fname.clear();
56  fdesc.clear();
57  }
58 
59  fd = fopen(pathname.c_str(), mode);
60  if (!fd)
61  {
62  if (desc)
63  LOG_ERROR("Cannot open %s (%s): %s", pathname.c_str(), desc, strerror(errno));
64  else
65  LOG_ERROR("Cannot open %s: %s", pathname.c_str(), strerror(errno));
66  return false;
67  }
68 
69  fname = pathname;
70  if (desc) fdesc = desc;
71 
72  return true;
73 }