bool TestExtFile::test_ftruncate() {
  Variant f = f_fopen("test/test_ext_file.tmp", "w");
  f_fputs(f, "testing ftruncate");
  f_fclose(f);

  f = f_fopen("test/test_ext_file.tmp", "r+");
  f_ftruncate(f, 7);
  f_fclose(f);

  f = f_fopen("test/test_ext_file.tmp", "r");
  VS(f_fread(f, 20), "testing");
  return Count(true);
}
Beispiel #2
0
static int
e_hfat_truncate (int fd, fs_off_t pos)
{
  int ret;
  FN_FILE *fp;

  fp = fd_to_file (fd);

  ret = f_ftruncate (fp, (unsigned long) pos);

  if (ret)
    return hfat_to_efs_err (ret);

  return 0;
}