This is my program before, but my teacher ask me to recode the program.. its required to use fgetc(); for character input, but i think its wrong... and I have ong error, its so confusing.. HELP ME!!
I wish someone will help me again..
Code:
#include<stdio.h>
void main(void)
{
FILE *inputf;
char filename[40];
int c;
printf("Input name of the text file");
fgetc(filename,10,stdin);
if (inputf = fopen(filename, "r") == NULL)
{
printf("ERROR: %s cannot be opened.\n", filename);
exit(1);
}
while ((c = fgetc(inputf)) != EOF)
fputc(c, stdout);
fclose(inputf);
}