[R] iostream (was: is R multi-threaded?)

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Nov 26 17:05:00 CET 2003

Annie Bibble <flyfish72 at fastmail.fm> writes:

> In the "Writing extensions for R" document, there is a part that reads:
> "Using C++ iostreams, as in this example, is best avoided.  There is
> no guarantee that the output will appear in the R console..."
> Does R do anything that would potentially cause a stream:: method in a
> dynamically-loaded library to get stuck waiting for a mutex?  Or is
> this just a warning about potential formatting issues?
> (on linux)

Printing in R generally goes through Rprintf or REprintf, these may be
redefined to send output into (e.g.) a GUI widget. Iostreams bypass
this mechanism and print to the originating terminal or into
/dev/null, which is likely not what you want.

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

More information about the R-help mailing list