From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Rolex JM" Newsgroups: gmane.emacs.help Subject: Re: Emacs doesn't show printf() output during debugging. Date: Fri, 19 Aug 2005 11:25:01 +0000 Message-ID: References: <17155.44117.665679.637142@farnswood.snap.net.nz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=gb2312; format=flowed X-Trace: sea.gmane.org 1124451125 27273 80.91.229.2 (19 Aug 2005 11:32:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 19 Aug 2005 11:32:05 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 19 13:32:02 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E6564-0005er-Vh for geh-help-gnu-emacs@m.gmane.org; Fri, 19 Aug 2005 13:31:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E659R-0001tK-BJ for geh-help-gnu-emacs@m.gmane.org; Fri, 19 Aug 2005 07:35:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E6579-0001rm-2G for help-gnu-emacs@gnu.org; Fri, 19 Aug 2005 07:32:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E6575-0001r1-Ft for help-gnu-emacs@gnu.org; Fri, 19 Aug 2005 07:32:45 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E6574-0001pe-MD for help-gnu-emacs@gnu.org; Fri, 19 Aug 2005 07:32:42 -0400 Original-Received: from [64.4.46.117] (helo=hotmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1E65Fr-0001ts-2W for help-gnu-emacs@gnu.org; Fri, 19 Aug 2005 07:41:47 -0400 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 19 Aug 2005 04:25:02 -0700 Original-Received: from 80.15.249.149 by by9fd.bay9.hotmail.msn.com with HTTP; Fri, 19 Aug 2005 11:25:01 GMT X-Originating-IP: [210.21.227.66] X-Originating-Email: [rolexletter@hotmail.com] X-Sender: rolexletter@hotmail.com In-Reply-To: <17155.44117.665679.637142@farnswood.snap.net.nz> Original-To: help-gnu-emacs@gnu.org X-OriginalArrivalTime: 19 Aug 2005 11:25:02.0040 (UTC) FILETIME=[A3DE9580:01C5A4B0] X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:28860 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:28860 I have tried setvbuf (stdout, (char *) NULL, _IONBF, 0); and fflush(stdout); respectively. They both worked. Thanks lot. >From: Nick Roberts >To: Lao JM >CC: help-gnu-emacs@gnu.org >Subject: Re: Emacs doesn't show printf() output during debugging. >Date: Thu, 18 Aug 2005 09:29:57 +1200 > > > > When I debug my C program, I can't see the printf() output in any buffer. > > However, I can provide input to scanf() in the GUD buffer. What should > > I do to show the output? I am using Emacs 21.3.50.1 (CVS) on Windows2000. > >I don't debug on Windows but I have been told that this works: > >;; If you are using Emacs and GDB on Windows you will need to flush the buffer >;; explicitly in your program if you want timely display of I/O in Emacs. >;; Alternatively you can make the output stream unbuffered, for example, by >;; using a macro: >;; >;; #ifdef UNBUFFERED >;; setvbuf (stdout, (char *) NULL, _IONBF, 0); >;; #endif >;; >;; and compiling with -DUNBUFFERED while debugging. > >I think that if the string to be printed is terminated with \n, this will >also display at the desired time (line buffering?). > >Nick _________________________________________________________________ Ãâ·ÑÏÂÔØ MSN Explorer: http://explorer.msn.com/lccn/