in reply to Re: Need to pass an unsigned char array from an xsub back to Perl
in thread Need to pass an unsigned char array from an xsub back to Perl
If I had not converted the unsigned char back to char, the compiler complains of signedness.PREINIT: unsigned char uuid_arr[16]; CODE: char convert_arr[33]; int i; XGenerateSessionID((uuid_t*) &uuid_arr); memset(convert_arr,'\0',33); for(i=0; i< 16; i++){ snprintf(&convert_arr[i*2], sizeof(convert_arr)-(i*2), "%02X" +, uuid_arr[i]); } RETVAL = newSVpvn(convert_arr,33); OUTPUT: RETVAL
|
|---|