From owner-freebsd-hackers@FreeBSD.ORG Wed May 26 05:26:04 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0C15916A4CE for ; Wed, 26 May 2004 05:26:04 -0700 (PDT) Received: from mail.shock.ro (mail.shock.ro [212.93.151.164]) by mx1.FreeBSD.org (Postfix) with ESMTP id B518E43D1F for ; Wed, 26 May 2004 05:26:01 -0700 (PDT) (envelope-from aanton@reversedhell.net) Received: from localhost (localhost.ro [127.0.0.1]) by mail.shock.ro (Postfix) with ESMTP id 61AAB89 for ; Sat, 22 May 2004 19:26:07 +0300 (EEST) Received: from mail.shock.ro ([127.0.0.1]) by localhost (mail.shock.ro [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 39968-02 for ; Sat, 22 May 2004 19:26:07 +0300 (EEST) Received: from [10.0.0.2] (unknown [81.196.32.25]) by mail.shock.ro (Postfix) with ESMTP id D518986 for ; Sat, 22 May 2004 19:26:06 +0300 (EEST) Message-ID: <40AF7F5A.1080500@reversedhell.net> Date: Sat, 22 May 2004 19:27:06 +0300 From: Anton Alin-Adrian User-Agent: Mozilla Thunderbird 0.6 (X11/20040516) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org X-Enigmail-Version: 0.84.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at shock.ro Subject: fopen("file","a") X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 May 2004 12:26:04 -0000 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-- Has the following output: --dump-- fopen(fqueue,"a"): Unknown error: 0 --dump-- With that said, commenting out the exit() and using fputs() to write to the file works smoothly, data is written correctly, and no error is barked out. Same goes for fprintf(). The snippet is so small, but I did learn that it's good to ask: am I doing something wrong, or is there something else wrong? Any suggestion is gratefully appreciated. Regards, -- Alin-Adrian Anton Reversed Hell Networks GPG keyID 0x1E2FFF2E (2963 0C11 1AF1 96F6 0030 6EE9 D323 639D 1E2F FF2E) gpg --keyserver pgp.mit.edu --recv-keys 1E2FFF2E