Function, pure R to C

Convert a string scalar (CHARSXP) to a C-string (char *).

Arguments

x

a pointer SEXP, of type CHARSXP.

Value

C string, i.e., a pointer char *.

Declaration

const char *(R_CHAR)(SEXP x);

In Rinternals.h.

Definition

const char *(R_CHAR)(SEXP x) {
  if(TYPEOF(x) != CHARSXP) // Han-Tak proposes to prepend  'x && '
  error("%s() can only be applied to a '%s', not a '%s'",
        "CHAR", "CHARSXP", type2char(TYPEOF(x)));
  return (const char *) CHAR(CHK(x));
}

In memory.c.

See also