.cc fopen failed - Broken Pipe

hello..
i make some code with C in freebsd 5.4 and compile it in solaris
somehow i succeed compile the program.
but when i run it, i got error message "Broken Pipe"
i looked out the syntax that that caused this,

fp = fopen("file.tmp","r");

does anyone know why, and how to solve this problem?

Are you doing any error checking for that fopen? After the fopen make sure that you check if fp is being set to NULL. If it is, you can use perror() or errno to check the exact error.

The error messages aren't trick questions. It sounds like file.tmp, or some other file your program was using, is a pipe, a pipe which closes on the other end while your program is still using it.

I don't really get it to set the fp to null
isn't it fp = NULL; or something else :confused:
and the file is not a pipe, i created it using another process using bash shell
the file contains of size information on disk
df -k | awk bla bla bla >> file.tmp
anyway i give up :stuck_out_tongue: and change the program a little
it solved now
thx very much :smiley: