CHARACTER_VALUE.Rd
x | a pointer |
---|
C string, i.e., a pointer char *
.
#define CHARACTER_VALUE(x) CHAR(Rf_asChar(x)) #define STRING_VALUE(x) CHAR(Rf_asChar(x))
In Rinternals.h.
# Convert an R object to a C-string (char *) to_string <- inline::cfunction(c(x = "any"), ' const char* x_; x_ = CHARACTER_VALUE(x); Rprintf("%s\\n", x_); return R_NilValue; ' const char* x_; x_ = CHARACTER_VALUE(x); Rprintf("%s\\n", x_); return R_NilValue; ') invisible(to_string(1L))#> 1#> 3.141593#> TRUE#> NA