Code:
#include <stdio.h>
int check(int a)
{
FILE * Tmp;
if ( ( Tmp = fopen(a, "r+") ) == 0 )
{
printf("no");
}
else
{
printf("yes");
}
fclose(Tmp);
return 0;
}
int main()
{
check("read.txt");
return 0;
}
Passing argument 1 of fopen function makes pointer from integer without a cast.
This was only a warning from the compiler. This works, but why am I getting the warning? I was trying to put the same concept as the following into a file existance check....
Code:
int display_message(int a)
{
printf("The color you have chose is %s", a);
printf("Bla bla bla...");
return 0;
}