0
我试图从r传递字符串到c并希望达到字符串的单个字符。无法读取字符串的字符,除了第一个从r调用c程序
到目前为止,我可以读取第一个字符和字符串作为整体,但是,在我从R传递的字符串的第一个字符后导致R解释器崩溃后,我可以读取任何内容。
这里是C代码
void test(char** str1) {
printf("%s\n", *str1);
printf("%c\n", *str1[0]);
//printf("%c\n", *str1[1]); // without this, it works fine.
}
这里是R代码
str1 = "foo"
returned_data = .C("test", as.character(str1))
我完全无能。我在这里错过了什么?
谢谢。不能相信我错过了括号。 – bfaskiplar