Skip to content
Prev 42782 / 63424 Next

Dealing with printf() &c. in third-party library code

Martin,

Thanks for your reply. I wonder if you'd be willing to post your
"my_fprintf" function, since I'm struggling to get around needing to
use the "stdout" and "stderr" symbols completely. This function has
the right effect...

void rniftyreg_fprintf (FILE *stream, const char *format, ...)
{
   va_list args;
   va_start(args, format);

   if (stream == stdout)
       Rvprintf(format, args);
   else if (stream == stderr)
       REvprintf(format, args);
   else
       vfprintf(stream, format, args);

   va_end(args);
}

... but the R CMD check info message still arises because stdout and
stderr still appear. I'm struggling to see how to get around this
without doing something really ugly, like casting integers to FILE*
pointers.

All the best,
Jon
On 15 March 2012 05:04, Martin Morgan <mtmorgan at fhcrc.org> wrote: