fopen("file","a")

Stuart Walsh stu at ipng.org.uk
Wed May 26 06:34:22 PDT 2004


----- Original Message ----- 
From: "Anton Alin-Adrian" <aanton at reversedhell.net>
To: <freebsd-hackers at freebsd.org>
Sent: Saturday, May 22, 2004 5:27 PM
Subject: fopen("file","a")


> Hey folks.
>
> Running FreeBSD 4.9-RELEASE
>
> I am just wondering:
>
> man fopen
> ---man---
>       Upon successful completion fopen(), fdopen() and freopen() return a
> FILE pointer.  Otherwise, NULL is returned and the global variable errno
is
> set to indicate the error.
> ---man---
>
>
> However, the following snippet:
>
> --snip--
> FILE *fp_queue;
>
> if ( (fp_queue=fopen(fqueue,"a"))  ==NULL);//will wait for locks
> {
> perror("fopen(fqueue,\"a\")");
> //exit(EXIT_FAILURE);
> }
> --snip--
>
>

You have a semicolon after your if... looks like a typo, but that will mean
the perror always gets called.

Regards,

Stuart



More information about the freebsd-hackers mailing list