[Rd] allocating character string of given size for .C
Tamas K Papp
tpapp at Princeton.EDU
Wed Aug 2 17:08:11 CEST 2006
Hi,
I have a C function (called via .C) which returns (by writing into
buffers) some values of known (or fixed) length, all of these are
numerical so I can allocate storage for them via as.double() and
as.integer().
However, there is a potential error message that I would like to
return into a char * buffer [1]. How can I allocate it in R (eg
something similar to as.integer(), but taking the number of
characters).
I would like to avoid .Call if possible, this is the only tricky
argument.
Thanks,
Tamas
[1] I would of course use strncpy to avoid overflows.
More information about the R-devel
mailing list