fseek.c 367 B

1234567891011121314151617
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "test_helpers.h"
  4. int main(void) {
  5. FILE *f = fopen("stdio/stdio.in", "r");
  6. ERROR_IF(fopen, f, == NULL);
  7. if (fseek(f, 14, SEEK_CUR) < 0) {
  8. puts("fseek error");
  9. exit(EXIT_FAILURE);
  10. }
  11. char buffer[256];
  12. printf("%s", fgets(buffer, 256, f));
  13. printf("ftell: %ld\n", ftello(f));
  14. }