Skip to content
Prev 4529 / 15075 Next

Directing output to R.app GUI from compiled C code

Thank you for everyone's help on this.  I think I have narrowed the  
issue down to the buffer.  When I run R in the terminal, the line:

fprintf(stdout,"testing\n");

gets flushed after each line, but when I run under R.app, all calls  
get flushed at the end of my program.

If I add the line

fflush(stdout);

after each fprintf call in R,app, the text is flushed as expected.

The line

fprintf(stderr,"testing\n");

gets flushed line-by-line in both cases.

So, for some reason, I need to flush the stdout buffer after each line  
in R.app, but not when I run R in terminal.  This is an easy  
workaround, although I am interested by this would work differently in  
the terminal and GUI versions of R.
On Mar 29, 2008, at 7:00 PM, Simon Urbanek wrote:
Michael Braun
Assistant Professor of Management Science (Marketing Group)
MIT Sloan School of Management
One Amherst St., E40-169
Cambridge, MA 02142
braunm at mit.edu
617-253-3436