I have tried
setvbuf (stdout, (char *) NULL, _IONBF, 0);
and
fflush(stdout);
respectively. They both worked. Thanks lot.
From: Nick Roberts <[EMAIL PROTECTED]>
To: Lao JM <[EMAIL PROTECTED]>
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/
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs