INNER CODE UNIT · C

fs_file_size

tek256/astera · src/asset.c:12

static uint32_t fs_file_size(const char* fp) {
  if (!fp) {
    ASTERA_FUNC_DBG("no file path passed\n");
    return 0;
  }

  FILE* f = fopen(fp, "r");

  if (!f) {
    ASTERA_FUNC_DBG("unable to open file %s\n", fp);
    return 0;
  }

  fseek(f, 0, SEEK_END);
  uint32_t length = (uint32_t)ftell(f);
  fclose(f);

  return length;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…