Re: [Rd] Replacements for stdout and stderr guaranteed to be open in all versions of R

From: Duncan Murdoch <>
Date: Fri, 11 May 2012 18:36:35 -0400

On 12-05-11 5:36 PM, David Sterratt wrote:
> I maintain the geometry package, which integrates the Qhull C library
> ( into R. The Qhull function I hook into requires an
> open FILE handle as one of its arguments. I had set this file handle to
> stdout, but now R check NOTEs the presence of stdout, and the CRAN
> maintainers asked me to get rid of these NOTEs.
> Including the following defines means the checks are passed on CRAN:
> #ifdef WIN32
> extern FILE * R_Consolefile;
> extern FILE * R_Outputfile;
> #else
> #include<Rinterface.h>
> #fi
> #undef stderr
> #define stderr R_Consolefile
> #undef stdout
> #define stdout R_Outputfile
> However, this does not work on Rgui.exe, when the above leads to a
> crash. Looking at
> it would appear that R_Consolefile and R_Outputfile only point to open
> files when CharacterMode == RTerm, not in GUI mode.
> Therefore my question is, are there any replacements for stdout and
> stderr that work across all versions of R?

I'm pretty sure the answer is "no". What you can do is have your initialization code open a new handle (pointing to something that is not stdout, e.g. a file), and then pass that to the Qhull function.

Duncan Murdoch mailing list Received on Fri 11 May 2012 - 22:43:00 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 13 May 2012 - 00:41:14 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive