Asking for an input and printing in a C interface for R

Viewed 23

I'm trying to modify a CRAN package. From what I understand, they use a C interface using .Call(). So I made changes in the C code (can't do it anywhere else since it's in a loop) but I need to ask the user to input an integer.

I read the "Writing R extension" doc and found out that you need to use specific functions as Rprintf() instead of printf().

But I can't seem to find a way to replace scanf() so how can we ask for an input?

And finally is Rprintf() supposed to print in the R console because it is what I'd want but I can't find where it is printed?

Edit: I'm unable to try it right now but it may seem that using capture_output() may work to get the Rprintf() output. Therefore the only remaining issue would be the scanf() :)

Thanks a lot!

0 Answers
Related