c - gcc compile error: unknown type name 'File' -
i learning how use file i/o using c.
this code in file, test.c
#include <stdio.h> #include <stdlib.h> int main() { file *fp; char *mode = "r"; fp = fopen("testfile", mode); if(fp == null) { fprintf(stderr, "can't open input file testfile\n"); exit(1); } }
when compile code using : gcc -o test test.c
i error :
atria:~/471/a4> gcc -o test test.c test.c: in function ‘main’: test.c:6:5: error: unknown type name ‘file’ file *fp; ^ test.c:10:8: warning: assignment incompatible pointer type [enabled default] fp = fopen("testfile", mode); ^
i thought maybe using wrong header file have included stdio.h
does have ideas why i'm getting error? thank in advance
that should file
, not file
.
Comments
Post a Comment