I'm using fscanf
to read some int
values from a file. It works correctly, but the way I did it, compiler gives a few warnings.
Source:
FILE *fp = NULL;
fp = fopen(argv[1],"r");
int num;
while(fscanf(fp,"%d",&num) != EOF) // This is the line 46
printf("%d ",num);
Warnings:
passing argument 1 of ‘fscanf’ from incompatible pointer type
format not a string literal and no format arguments [-Wformat-security]
passing argument 2 of ‘fscanf’ from incompatible pointer type
Line breakpoint: main.c [line: 46]
What am I doing wrong?
redefine prototype of fscanf, actual code is different E.g
fscanf("%d",&num)
. (before save?) – BLUEPIXY