I have a piece of code in vb. I need to convert array of bytes to base 64 string. Following is the vb code.
If arrLicence.Count > 0 Then
LicenceByt
//strBusiCode = @"64-37-81-d4-39-6d";
NSArray *tmp_arr = [strBusiCode componentsSeparatedByString:@"-"];
NSMutableData *commandToSend= [[NSMutableData alloc] init];
unsigned char whole_byte;
char byte_chars[3] = {'\0','\0','\0'};
int i;
for (i=0; i < [tmp_arr count]; i++) {
byte_chars[0] = [[tmp_arr objectAtIndex:i] characterAtIndex:0];
byte_chars[1] = [[tmp_arr objectAtIndex:i] characterAtIndex:1];
whole_byte = strtol(byte_chars, NULL, 16);
[commandToSend appendBytes:&whole_byte length:1];
}
return commandToSend;
This commandToSend is then converted to base64 data.