I am having trouble handing "raw" data to a C function, using "cfunction", as 
demonstrated in the function and output pasted below.  Can anyone suggest what 
I'm doing incorrectly?  Thanks.  Dan Kelley [Dalhousie University].


1. TEST FILE

library(inline)
code <- 'Rprintf("inside f(), b is 0X%x\\n", *b);'
f <- cfunction(sig=signature(b="raw"),
               body=code,
               convention=".C")
b <- as.raw(0x0f)
for (i in 1:5)
    f(b)




2. SAMPLE OUTPUT FROM TEST FILE

inside f(), b is 0X70
inside f(), b is 0X80
inside f(), b is 0X70
inside f(), b is 0X60
inside f(), b is 0X50
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to