in reply to usage libc in perl, how using char's?

How are you linking your Perl code to the C code? Are you using Inline::C? Otherwise, if you pass in a Perl scalar, you will need to use the appropriate macros to get at the data payload. To get at the string part of a scalar, you need to use

char* strval = SvPV(str);

I recommend looking at illguts to learn about the low level Perl data structures.