xref: /relibc/tests/stdio/fseek.c (revision ed19381547d66b76981ea1e4ff942c5a4da45ab7)
1 #include <stdio.h>
2 #include <stdlib.h>
3 
4 #include "test_helpers.h"
5 
6 int main(void) {
7     FILE *f = fopen("stdio/stdio.in", "r");
8     ERROR_IF(fopen, f, == NULL);
9 
10     int status = fseek(f, 14, SEEK_CUR);
11     ERROR_IF(fseek, status, == -1);
12     UNEXP_IF(fseek, status, != 0);
13 
14     char buffer[256];
15     printf("%s", fgets(buffer, 256, f));
16 
17     off_t pos = ftello(f);
18     ERROR_IF(ftello, pos, == -1);
19     printf("ftello: %ld\n", pos);
20 }
21