#include <stdio.h>
#include <stdlib.h>

int main() {

  char file[] = "tmp.bin";
  double v;

  printf("Seeking %s\n", file);
  FILE *fp = fopen(file, "rb");

  fseek( fp, 4l, SEEK_SET );
  printf("[SEEK_SET  4l] File position: %ld\n", ftell(fp));

  fread( &v, sizeof(v), 1, fp );
  printf("Read 1 element. v: %f, file position: %ld\n", v, ftell(fp));

  fseek( fp, -1l, SEEK_CUR );
  printf("[SEEK_CUR -1l] File position: %ld\n", ftell(fp));

  fseek( fp, 0l, SEEK_END );
  printf("[SEEK_END  0l] File position: %ld\n", ftell(fp));
}