Hi, that's not going to fly.
A CharacterVector holds strings of arbitrary lengths, well technically it holds other R objects (SEXP) that hold pointers to strings. A RawVector holds unsigned char. Can you add some meat to your example, e.g. what you'd expect to go in, etc ... Romain > Le 20 oct. 2014 à 21:17, Gustaf Granath <[email protected]> a écrit : > > Hi > Im trying to use some C++ functions in R. However, these functions are build > around unsigned char* variables (1D array). I have for example a large matrix > in R that represents black (e.g. 1-bit image, 0 and 1s). I cant find a > solution to convert a character vector into unsigned char* within Rcpp. Im > new to Rcpp and C++ so I might have missed something obvious here. Please > direct me to resources on this topic (google did not help much). > > A start: > > SEXP test(SEXP cM){ > CharacterVector Vc(cM); > int n = Vr.size(); > RawVector x(n); //is this the same as unsigned char* ? > //I tried to fill it with char*(Mr) but I didnt > succeed > } > > Thanks, > > Gustaf > > -- > Gustaf Granath (PhD) > Post doc > McMaster University > School of Geography & Earth Sciences > > _______________________________________________ > Rcpp-devel mailing list > [email protected] > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel _______________________________________________ Rcpp-devel mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
