From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: kgold@watson.ibm.com (kgold) Newsgroups: gmane.emacs.help Subject: Re: get stdout/stderr while running a program Date: 2 Dec 2002 14:48:25 GMT Organization: IBM T.J. Watson Research Center Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1038841792 7508 80.91.224.249 (2 Dec 2002 15:09:52 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 2 Dec 2002 15:09:52 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18IsCi-0001wi-00 for ; Mon, 02 Dec 2002 16:09:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18IsDx-0002AU-00; Mon, 02 Dec 2002 10:11:05 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!uunet!sea.uu.net!sac.uu.net!news.chips.ibm.com!newsfeed.btv.ibm.com!news.btv.ibm.com!kgold Original-Newsgroups: gnu.emacs.help Original-Lines: 22 Original-NNTP-Posting-Host: alpha.watson.ibm.com Original-X-Trace: news.btv.ibm.com 1038840505 16884 9.2.16.245 (2 Dec 2002 14:48:25 GMT) Original-X-Complaints-To: news@btv.ibm.com Original-NNTP-Posting-Date: 2 Dec 2002 14:48:25 GMT X-Newsreader: xrn 9.01 Originator: kgold@watson.ibm.com Original-Xref: shelby.stanford.edu gnu.emacs.help:107650 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:4201 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:4201 emacs uses a pipe to route stdout to the buffer. The C default for pipes is fully buffered. So you don't see the output until exit or the buffer is full. Put this into your C program main(): setvbuf(stdout,0,_IONBF,0); I'm not sure about stderr, since I thought it was unbuffered by default.. Nagash writes: > > i've got a small problem with c-programs writing on > stdout/stderr. i cannot see the output while running the > program over the emacs shell access. > after exiting the program the buffer gets filled. > a simultaneous output mode would be nice for debug... -- Ken Goldman kgold@watson.ibm.com 914-784-7646