Print a file to the console in C
Oct 19, 2021
int main()
{
FILE *fptr;
int n = 0;
int ch = 0;
if ((fptr = fopen(pathtoyourfile, "r")) == NULL)
{
printf(“Error.”);
exit(1);
}while ( (ch = fgetc(fptr)) != EOF ){printf("%c", ch);
n++;
}
fclose(fptr);return 0;
}