From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16853 invoked by alias); 16 Mar 2011 21:09:07 -0000 Received: (qmail 16837 invoked by uid 22791); 16 Mar 2011 21:09:06 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay01.alfahosting-server.de (HELO relay01.alfahosting-server.de) (80.86.191.88) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 16 Mar 2011 21:09:02 +0000 Received: by relay01.alfahosting-server.de (Postfix, from userid 1001) id D0D3432C0105; Wed, 16 Mar 2011 22:08:59 +0100 (CET) X-Spam-DCC: STAT_FI_X86_64_VIRTUAL: relay01 1245; Body=1 Fuz1=1 Fuz2=1 Received: from alfa3018.alfahosting-server.de (alfa3018.alfahosting-server.de [82.197.146.36]) by relay01.alfahosting-server.de (Postfix) with ESMTP id D743E32C03AA for ; Wed, 16 Mar 2011 22:08:56 +0100 (CET) Received: from pc.martinlaabs.de (p54B33B53.dip.t-dialin.net [84.179.59.83]) by alfa3018.alfahosting-server.de (Postfix) with ESMTPSA id 890FF515C04F for ; Wed, 16 Mar 2011 22:08:56 +0100 (CET) Message-ID: <4D8126E4.2090101@mailbox.tu-dresden.de> Date: Wed, 16 Mar 2011 21:09:00 -0000 From: Martin Laabs Reply-To: uni@martinlaabs.de User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1.16) Gecko/20101223 Lightning/1.0b1 Thunderbird/3.0.11 MIME-Version: 1.0 To: ecos-devel@sources.redhat.com Subject: Bug in fprintf/fscanf Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checker-Version: clamassassin 1.2.4 with ClamAV 0.97/12847/Wed Mar 16 18:00:16 2011 X-IsSubscribed: yes Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2011-03/txt/msg00010.txt.bz2 Hello, could someone please verify the following bug I discovered. It seems that fprintf (or fputs) fails after a fscanf call. The second fprintf call however does work as expected. I currently use the network as stream. Maybe this bug is because I use the fdopen function but at the moment I do not have an other working file descriptor. Follwoing Code: term=fdopen(clntSock, "r+"); assert(term!=0); while(1) { fprintf(term, "Type a number\n"); diag_printf("fscanf %d\n", fscanf(term, "%d",&num)); diag_printf("fprintf1 %d\n",fprintf(term, "Number was %d\n",num)); diag_printf("fprintf2 %d\n",fprintf(term, "Again - Number was %d\n",num)); } Produces following output (with Input of 8, 9 and 10): Type a number 8 Again - Number was 8 Type a number 9 Again - Number was 9 Type a number 10 Again - Number was 10 Type a number With diag output of: fscanf 1 fprintf1 0 fprintf2 21 fscanf 1 fprintf1 0 fprintf2 21 fscanf 1 fprintf1 0 fprintf2 22 The complete code is available under http://pastebin.com/8iYVkAhz Greetings, Martin Laabs