Reputation: 2999
I have code like this:
NSData *data = [NSData dataWithContentsOfURL:objURL];
const void *buffer = [data bytes];
[self _loadData:buffer];
[data release];
the "_loadData" function takes an argument like:
- (void)_loadData:(const char *)data;
How do I convert "const void " to a "const char" on Objective-C?
Upvotes: 3
Views: 8094
Reputation: 95355
You mustn't release the data object because you did not explicitly allocate it. Also, you could do a simple cast:
[self _loadData:(const char *) buffer];
Upvotes: 3
Reputation: 3498
Just like you would in C:
[self _loadData:(const char *)buffer];
should work.
Upvotes: 5