This should be easy, but I'm having some trouble. I'm attempting to create an NSString from a multidimensional bool array so that I can store and transmit it.
I have a bool array:
bool wall[100][100];
I would like the bytes of the array to be converted to a string. I have tried many different methods of creating an NSString from the array including the following.
This results in no output.
I'm guessing that this is due to the mismatch in size and the requirements o the encoding, but both are complex to solve and I'm going at this blind.
Any help would be greatly appreciated.
Thanks
I have a bool array:
bool wall[100][100];
I would like the bytes of the array to be converted to a string. I have tried many different methods of creating an NSString from the array including the following.
Code:
NSData *wallData = [NSData dataWithBytes:wall length:sizeof(wall)];
NSString* wallString = [[NSString alloc] initWithData:wallData encoding:NSUTF8StringEncoding];
NSLog(wallString);
This results in no output.
I'm guessing that this is due to the mismatch in size and the requirements o the encoding, but both are complex to solve and I'm going at this blind.
Any help would be greatly appreciated.
Thanks