MIPI_BaseC_WebinarFRTK/10_Lecture10/02_file_ftell_p17.c
2024-11-13 09:22:28 +03:00

20 lines
440 B
C

#include <stdio.h>
int main(void){
FILE *f;
static char filename[100]={0};
size_t size;
printf("Input file name: ");
scanf("%s",filename);
f = fopen (filename, "r");
if (f != NULL) {
fseek (f, 0, SEEK_END);
size = ftell (f);
fclose (f);
printf ("File size of '%s' - %lu bytes.\n",filename, size);
} else {
printf ("Can't open file %s\n", filename);
}
return 0;
}