On Thu, 12 Apr 2007, mel wrote:

Prof Brian Ripley a écrit :

If you are using Rgui (it should work under rterm)

yes indeed, it works under rterm

there is no C-level 'stdout' file stream (the normal state
for Windows GUI programs), so no way to capture it inside R.

Aie ! (I feared this answer). Thanks however for the explanation.
I was looking at pipe(), scan() etc.
So, no hope from this side.

If you have the program, can you not edit it before compiling it?
Adding
#define printf Rprintf
will probably do the trick.

yes thanks, I already though on that, and it works.
But i would have preferred not touching this 3rd party code.

You can always link in a wrapper that defined printf and passes the arguments to Rprintf.

=====================================

There is another little annoyance (always on WindowsXP + R-2.4.1)
When including both <windows.h> and <R.h>
#include <windows.h>
#include <R.h>

There is a #define ERROR redefinition

#define ERROR ),error(R_problem_buf);} // this one in Rs.h
#define ERROR 0                        //  in MinGW/.../wingdi.h

It's only a warning, but i would prefer to avoid it
and i'm searching how to avoid it.
Thanks for any idea.

It's documented in 'Writing R Extensions'.

  The defines used for compatibility with @Sl{} sometimes causes
  conflicts (notably with Windows headers), and the known
  problematic defines can be removed by defining @code{STRICT_R_HEADERS}.




PS : compilation details :

g++ -IJ:/softs/R-2.4.1/include -c f1.cpp -o f1.o
In file included from J:/softs/R-2.4.1/include/R.h:49,
                 from f1.cpp:11:
J:/softs/R-2.4.1/include/R_ext/RS.h:40:1: warning: "ERROR" redefined
In file included from
f:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/windows.h:52,
                 from f1.cpp:10:
f:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/wingdi.h:313:1:
warning: this is the location of the previous definition

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


--
Brian D. Ripley,                  [EMAIL PROTECTED]
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
______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to