[Rd] File and console output does not work in C code

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jan 28 18:43:25 CET 2009

On Wed, 28 Jan 2009, Benjamin Leblanc wrote:

> Hello all,
> I am getting into trouble when trying to do standard I/O from a C function 
> called within R environment.
> This function is written in a small C library that is loaded whith dyn.load() 
> and called in R via the .C() interface. I need to debug the C code using a 
> text file for some logs, and also to speed up its result visualization by 
> creating images on the fly using the GD library.
> Both of these outputs require to write into files from this C function.
> Allthough everything goes smoothly from compilation and linking to execution 
> into R without errors, no file is created. I have also tried to do some 
> simple printf(), Rprintf() and REprintf() but even that didn't gave me any 
> visible output.
> Am I missing something trivial? Could anyone give me a hint on why it does 
> not work?

It works in many other packages.  What OS are you using?  (There known 
issues with using stdout and stderr from GUIs, but those are 
documented in the R-exts manual.)

> Best regards,
> Benjamin
> -- 
> Chromatin and Cell Biology Lab.
> Institute for Human Genetics
> 141, rue de la Cardonille
> F-34396 Montpellier
> France
> Phone  +33-(0)4 99 61 99 51
> FAX      +33-(0)4 99 61 99 01
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list