Exemplo n.º 1
0
int
main(int argc, char **argv)
{
  Args args(argc, argv, "FILE.igc");
  const auto path = args.ExpectNextPath();
  args.ExpectEnd();

  GRecord g;
  g.Initialize();

  Error error;
  if (!g.LoadFileToBuffer(path, error)) {
    fprintf(stderr, "%s\n", error.GetMessage());
    return 2;
  }

  g.FinalizeBuffer();

  if (!g.AppendGRecordToFile(path)) {
    fprintf(stderr, "Failed to write file\n");
    return 2;
  }

  return 0;
}
Exemplo n.º 2
0
int
main(int argc, char **argv)
{
  if (argc != 2) {
    fprintf(stderr, "Usage: %s FILE.igc\n", argv[0]);
    return 1;
  }

#ifdef _UNICODE
  TCHAR path[PATH_MAX];
  int length = ::MultiByteToWideChar(CP_ACP, 0, argv[1], -1, path, PATH_MAX);
  if (length == 0)
    return 2;
#else
  const char *path = argv[1];
#endif

  GRecord g;
  g.Init();
  g.SetFileName(path);

  if (!g.LoadFileToBuffer()) {
    fprintf(stderr, "Failed to read file\n");
    return 2;
  }

  g.FinalizeBuffer();

  if (!g.AppendGRecordToFile(true)) {
    fprintf(stderr, "Failed to write file\n");
    return 2;
  }

  return 0;
}
Exemplo n.º 3
0
int
main(int argc, char **argv)
{
  Args args(argc, argv, "FILE.igc");
  tstring path = args.ExpectNextT();
  args.ExpectEnd();

  GRecord g;
  g.Initialize();

  if (!g.LoadFileToBuffer(path.c_str())) {
    fprintf(stderr, "Failed to read file\n");
    return 2;
  }

  g.FinalizeBuffer();

  if (!g.AppendGRecordToFile(path.c_str())) {
    fprintf(stderr, "Failed to write file\n");
    return 2;
  }

  return 0;
}