--- In [email protected], John Gaughan <[EMAIL PROTECTED]> wrote:
>
> When in doubt, casting NULL seems to work for me.
Assuming the OP is using C (filename is p.c), if you need to cast NULL
then something is wrong.
If the code is:
#include <stdio.h>
int main(void)
{
char a[]="hello\n";
FILE *fp;
fp = fopen("file","a");
if (fp == NULL) {
puts("fopen error");
exit(1);
}
return 0;
}
Compile under linux using gcc 4.1.2:
> gcc -Wall p.c
p.c: In function `main':
p.c:10: warning: implicit declaration of function `exit'
p.c:10: warning: incompatible implicit declaration of built-in
function `exit'
p.c:5: warning: unused variable `a'
Can you paste the whole code, compiler command line and output?
John