예제 #1
0
파일: Glue.cpp 프로젝트: Advi42/XCSoar
/**
 * Loads the FLARMnet file
 */
static void
LoadFLARMnet(FlarmNetDatabase &db)
try {
  auto reader = OpenDataTextFileA(_T("data.fln"));

  unsigned num_records = FlarmNetReader::LoadFile(*reader, db);
  if (num_records > 0)
    LogFormat("%u FLARMnet ids found", num_records);
} catch (const std::runtime_error &e) {
  LogError(e);
}
예제 #2
0
파일: Glue.cpp 프로젝트: DRIZO/xcsoar
/**
 * Loads the FLARMnet file
 */
static void
LoadFLARMnet(FlarmNetDatabase &db)
{
  NLineReader *reader = OpenDataTextFileA(_T("data.fln"));
  if (reader == NULL)
    return;

  unsigned num_records = FlarmNetReader::LoadFile(*reader, db);
  delete reader;

  if (num_records > 0)
    LogFormat("%u FLARMnet ids found", num_records);
}
void
FlarmDetails::LoadFLARMnet()
{
  NLineReader *reader = OpenDataTextFileA(_T("data.fln"));
  if (reader == NULL)
    return;

  unsigned num_records = FlarmNet::LoadFile(*reader);
  delete reader;

  if (num_records > 0)
    LogStartUp(_T("%u FLARMnet ids found"), num_records);
}
예제 #4
0
TLineReader *
OpenDataTextFile(const TCHAR *name, ConvertLineReader::charset cs)
{
#ifdef _UNICODE
  assert(name != NULL);
  assert(!StringIsEmpty(name));

  TCHAR path[MAX_PATH];
  LocalPath(path, name);

  FileLineReader *reader = new FileLineReader(path, cs);
  if (reader == NULL)
    return NULL;

  if (reader->error()) {
    delete reader;
    return NULL;
  }

  return reader;
#else
  return OpenDataTextFileA(name);
#endif
}