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

Description Arguments Value Declaration Definition See Also

Description

\Sexpr[results=rd, stage=render]{c3po:::badge('fnp')} \Sexpr[results=rd, stage=render]{c3po:::badge('r2c')}

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

1
const char *(R_CHAR)(SEXP x);

In Rinternals.h.

Definition

1
2
3
4
5
6
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

Rf_asChar


ramiromagno/c3po documentation built on Jan. 5, 2021, 8:01 p.m.