Compilation Errors

warning: unused variable `fp'
Even though I am using the fp variable
 fp=fopen("Reader.xml", "rb");
fgets(Buff, sizeof(Buff), fp);
Anyone know why...
sudarshantkAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
DineshJolaniaConnect With a Mentor Commented:
Simply , the code is unreachable. That might happen in several ways.
1) You may be returning well before fopen.
2) You might not be calling the function which was not called at all.
3) As above said by grg99
0
 
grg99Commented:
Try turning off optimization, soemtimes the compiler is too clever.

Also make sure that code is reachable, and not accidentally in a comment or #ifdef or a if( 0 )

0
 
PaulCaswellCommented:
Hi sudarshantk,

FILE * fp; // Will cause a warning.

...

{
  FILE *fp;
  ...
  fp=fopen("Reader.xml", "rb");
  fgets(Buff, sizeof(Buff), fp);
 
}

Perhaps you could post a little more code.

Paul
0
 
marchentCommented:
i din't see any complie error on my VC. by the way try with adding this line on your code for initialization.

FILE *fp=NULL;

regards
marchent
0
 
sudarshantkAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.