Reputation: 199
My problem:
I have code in Java that I need to port to Objective-C where
Obj[i] is byte[],
Buffer is byte[],
index is int
In my Objective C I have declared
Obj[i] is char**
Buffer is char*
index is int
and I am not able to convert this line buffer[index] = ((Byte)obj[i]).byteValue();
case cw_BYTE_obj:
if(obj[i] == NULL)
{
buffer[index] = 0x01;
index++;
buffer[index] = ((Byte)obj[i]).byteValue();
index++;
}
orginal java code
case cw_BYTE_obj:
if(obj[i] == null){
buffer[index] = 0x00;
index++;
}else{
buffer[index] = 0x01;
index++;
buffer[index] = ((Byte)obj[i]).byteValue();
index++;
}
break;
`
Upvotes: 2
Views: 203
Reputation: 679
First, why is obj a char** in obj-c when it's a byte[] in java? Anyhow, so you want a char to go into buffer[index], and obj[i] is char** so is probably a pointer to a char* ?? Depending on what you're putting into obj, you will probably be after something like buffer[index] = *(obj[i]);
Upvotes: 1