Hi Pieter, search for 'Rprintf' in the 'Writing R extensions' manual: http://cran.r-project.org/doc/manuals/r-release/R-exts.html
Gabor On Tue, May 26, 2015 at 9:55 AM, Pieter Eendebak <pieter.eende...@gmail.com> wrote: > Dear developers, > > For an R package I am including some code I have written previously which > uses stdout, stderr and printf. The command R CMD check [packagename] gives > me warnings about these items. What is the proper way to print output in an > R package? > > The documentation mentions that output is shpuld be written to the console. > Does this mean printing using printf only? > > In my code I have several constructions like: > > void print_structure(FILE *fid, object_t object); > void print_structure(object_t object) { > print_structure(stdout, object); > } > void print_structure(const char *filename, object_t object) { > FILE *fid = fopen(filename, 'wt'); > print_structure(fid, object); > fclose(fid); > } > > How can I keep using this code in R without duplicating the print_structure > function (once for output to console, and once for output to file)? > > With kind regards, > Pieter Eendebak > > [[alternative HTML version deleted]] > > ______________________________________________ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel > [[alternative HTML version deleted]] ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel