Rprintf loop status does not print under windows

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Rprintf loop status does not print under windows

Andrew Finley
Hello,
I am writing a c/c++ extension package that does some mcmc sampling, and
periodically writes the sampling status to the terminal via Rprintf.  So in
my sampling loop I have:

if(status == 100){
  Rprintf("%i...", s);
  status = 0;
}
status++;

Under linux/unix this works fine, but under windows the status is not
printed.  Am I missing something?

Thanks-
Andy

--
Andrew Finley, Research Fellow
Department of Forest Resources
College of Natural Resources
University of Minnesota
305 Green Hall
1530 Cleveland Avenue N.
St. Paul, MN 55108

Ph 612-624-1714 office
http://blue.fr.umn.edu/home

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Rprintf loop status does not print under windows

Duncan Murdoch
On 2/4/2006 1:14 PM, Andrew Finley wrote:

> Hello,
> I am writing a c/c++ extension package that does some mcmc sampling, and
> periodically writes the sampling status to the terminal via Rprintf.  So in
> my sampling loop I have:
>
> if(status == 100){
>   Rprintf("%i...", s);
>   status = 0;
> }
> status++;
>
> Under linux/unix this works fine, but under windows the status is not
> printed.  Am I missing something?

Looks like you have buffering enabled (the default).  In the Misc menu
item, uncheck "buffered output" and you should see things sooner (but
slower).

Duncan Murdoch

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Rprintf loop status does not print under windows

Liaw, Andy
In reply to this post by Andrew Finley


> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Duncan Murdoch
> Sent: Saturday, February 04, 2006 1:23 PM
> To: Andrew Finley
> Cc: [hidden email]
> Subject: Re: [Rd] Rprintf loop status does not print under windows
>
>
> On 2/4/2006 1:14 PM, Andrew Finley wrote:
> > Hello,
> > I am writing a c/c++ extension package that does some mcmc
> sampling, and
> > periodically writes the sampling status to the terminal via
> Rprintf.  So in
> > my sampling loop I have:
> >
> > if(status == 100){
> >   Rprintf("%i...", s);
> >   status = 0;
> > }
> > status++;
> >
> > Under linux/unix this works fine, but under windows the
> status is not
> > printed.  Am I missing something?
>
> Looks like you have buffering enabled (the default).  In the
> Misc menu
> item, uncheck "buffered output" and you should see things sooner (but
> slower).

... or add something like this in your C code:

#ifdef win32
            R_FlushConsole();
#endif

Andy
 
> Duncan Murdoch
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

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