[R] Pass String from R to C

Duncan Murdoch murdoch.duncan at gmail.com
Sun Apr 24 01:08:48 CEST 2011


On 11-04-23 7:04 PM, Jaimin Dave wrote:
> Hi,
> I am using a function which accepts the string from R and prints it.
> But when I am calling .C("main","hello");
> it is printing any random thing.
> My C function is
> void main(char *str)

See Writing R Extensions.  The declaration should be char **str.

Duncan Murdoch

> {
> Rprintf("%s",str);
> }
>
> Can you help how to achieve this using .C interface?
>
> Thanks
> Jaimin
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list