prog.c:1:1: error: unknown type name ‘FILE’
FILE* fopenText(char* fName, char* mode) {
^~~~
prog.c:1:1: note: ‘FILE’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’?
+#include <stdio.h>
FILE* fopenText(char* fName, char* mode) {
^~~~
prog.c: In function ‘fopenText’:
prog.c:2:2: error: unknown type name ‘FILE’
FILE* z;
^~~~
prog.c:2:2: note: ‘FILE’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’?
prog.c:3:6: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
if (strcmp(mode, "r") == 0) {
^~~~~~
prog.c:4:7: warning: implicit declaration of function ‘fopen’ [-Wimplicit-function-declaration]
z = fopen(fName, mode);
^~~~~
prog.c:4:7: note: ‘fopen’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’?
prog.c:4:5: warning: assignment to ‘int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
z = fopen(fName, mode);
^
prog.c:5:12: error: ‘NULL’ undeclared (first use in this function)
if (z == NULL) { fprintf(stderr, "can't open for r@fopenText\n"); exit(1); }
^~~~
prog.c:5:12: note: ‘NULL’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
prog.c:1:1:
+#include <stddef.h>
FILE* fopenText(char* fName, char* mode) {
prog.c:5:12:
if (z == NULL) { fprintf(stderr, "can't open for r@fopenText\n"); exit(1); }
^~~~
prog.c:5:12: note: each undeclared identifier is reported only once for each function it appears in
prog.c:5:20: warning: implicit declaration of function ‘fprintf’ [-Wimplicit-function-declaration]
if (z == NULL) { fprintf(stderr, "can't open for r@fopenText\n"); exit(1); }
^~~~~~~
prog.c:5:20: warning: incompatible implicit declaration of built-in function ‘fprintf’
prog.c:5:20: note: include ‘<stdio.h>’ or provide a declaration of ‘fprintf’
prog.c:5:28: error: ‘stderr’ undeclared (first use in this function)
if (z == NULL) { fprintf(stderr, "can't open for r@fopenText\n"); exit(1); }
^~~~~~
prog.c:5:28: note: ‘stderr’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’?
prog.c:5:69: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
if (z == NULL) { fprintf(stderr, "can't open for r@fopenText\n"); exit(1); }
^~~~
prog.c:5:69: warning: incompatible implicit declaration of built-in function ‘exit’
prog.c:5:69: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
prog.c:1:1:
+#include <stdlib.h>
FILE* fopenText(char* fName, char* mode) {
prog.c:5:69:
if (z == NULL) { fprintf(stderr, "can't open for r@fopenText\n"); exit(1); }
^~~~
prog.c:9:5: warning: assignment to ‘int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
z = fopen(fName, "r");
^
prog.c:11:4: warning: implicit declaration of function ‘fclose’ [-Wimplicit-function-declaration]
fclose(z);
^~~~~~
prog.c:12:4: warning: incompatible implicit declaration of built-in function ‘fprintf’
fprintf(stderr, "file exists for w@fopenText\n");
^~~~~~~
prog.c:12:4: note: include ‘<stdio.h>’ or provide a declaration of ‘fprintf’
prog.c:13:4: warning: incompatible implicit declaration of built-in function ‘exit’
exit(1);
^~~~
prog.c:13:4: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
prog.c:15:5: warning: assignment to ‘int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
z = fopen(fName, mode);
^
prog.c:16:20: warning: incompatible implicit declaration of built-in function ‘fprintf’
if (z == NULL) { fprintf(stderr, "can't open for w@fopenText\n"); exit(1); }
^~~~~~~
prog.c:16:20: note: include ‘<stdio.h>’ or provide a declaration of ‘fprintf’
prog.c:16:69: warning: incompatible implicit declaration of built-in function ‘exit’
if (z == NULL) { fprintf(stderr, "can't open for w@fopenText\n"); exit(1); }
^~~~
prog.c:16:69: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
prog.c:20:3: warning: incompatible implicit declaration of built-in function ‘fprintf’
fprintf(stderr, "unknown mode @fopenText");
^~~~~~~
prog.c:20:3: note: include ‘<stdio.h>’ or provide a declaration of ‘fprintf’
prog.c:21:3: warning: incompatible implicit declaration of built-in function ‘exit’
exit(1);
^~~~
prog.c:21:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’