#include <stdio.h>
int main() {
int a = 15;
char s[10];
int c;
/*putc('F', stdout);
puts("HELLO");
printf("I am %d years old", a);
c = getchar();
gets(s);
scanf("%d", &a);*/
FILE* file = fopen("./test.txt", "r");
//r w a r+ w+ a+
//rb wb ab rb+ wb+ ab+
if(file != NULL) {
/*fputc('F', file);
//fputc('\n', file);
fputs("HELLO", file);
fputc('\n', file);
fprintf(file, "I am %d years old", a);
fputc('\n', file);*/
fseek(file, 0, SEEK_SET);
c = fgetc(file);
fgets(s, 10, file);
fscanf(file, "%d", &a);
fclose(file);
printf("%c %s %d\n", c, s, a);
} else {
puts("File not found");
}
/*file = fopen("./test2.txt", "w");
for(int i=0; i<100; i++) {
fprintf(file, "%d\n", i);
}
fclose(file);*/
file = fopen("./test2.txt", "r");
if(file != NULL) {
int num;
while(fscanf(file, "%d", &num) != EOF) {
printf("I read %d\n", num);
}
}
fclose(file);
return 0;
}