#include <stdio.h>
int main()
{
char filename[100];
char ch;
printf("Enter the filename: ");
scanf("%s", filename);
FILE *file = fopen(filename, "r");
if (file == NULL)
{
printf("Error: Could not open file.\n");
return 1;
}
printf("File content:\n");
while (!feof(file))
{
printf("%c", fgetc(file));
}
fclose(file);
return 0;
}
Comments
Post a Comment