First, it will be much easier for you to debug this problem, and for others to help you, if you try to strip your file down to the minimum example. That aside, if this
fp = fopen( /* args omitted */ );
is giving you a "assignment makes pointer from integer without a cast" warning, then I suspect you don't have a declaration of fopen
in scope. Do you by any chance get a warning about an "implict declaration" near the first use of fopen
? If so, then you somehow don't have a proper declaration of fopen
available, and C automatically decides that it must return an integer.
I don't know why this would be happening, except that the very first line of your example code looks slightly odd:
#include<stdio.h>
Is this really how it appears in your source code? Normally, I'd expect
#include <stdio.h>
I don't recall right now if C should insist on a space between the #include
and <stdio.h>
.