At Thursday 10/2/2008 13:58, you wrote:
>     Is this proper use of perror.
>
>FILE *fp;
>if ((fp=fopen("file","w"))==NULL) {
>perror(fp);
>clearerr(fp);
>exit(EXIT_FAILURE);
>}
>
>I am passing the pointer to perror so if fopen fails perror should print a
>system message. And of course clearerr() needs to be used.
>
>Bill

No, that is incorrect. perror() takes a character string argument, 
not a FILE pointer. Take a look here:

http://www.google.com/search?q=perror%28%29&rls=com.microsoft:*:IE-SearchBox&ie=UTF-8&oe=UTF-8&sourceid=ie7&rlz=1I7SNCA

~Rick

Reply via email to