heres my program and I wonder if I can use fgetc() as alternative for scanf() to read an input character...
I think the way I used fgetc() their is technically wrong.. so anyone correct me please...??Code:#include<stdio.h> void main(void) { FILE *inputf; char filename[40]; int c; printf("Input name of the text file"); fgetc(filename); 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); }
THANKS!!



LinkBack URL
About LinkBacks


