Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
int main() {
FILE *fp;
char ch;
fp = fopen("output.txt", "r");
if (fp == NULL) {
printf("Error opening file\n");
return 1;
}
// Move pointer to 5th position
fseek(fp, 5, SEEK_SET);
printf("Character at position 5: %c\n", fgetc(fp));
// Current position
printf("Current position: %ld\n", ftell(fp));
// Rewind to beginning
rewind(fp);
printf("First character after rewind: %c\n", fgetc(fp));
fclose(fp);
return 0;
}Coding works best on desktop or with an external keyboard.