views:

79

answers:

1

How can I cast a NSString* into a char?

EDIT: Thanks to Vladimir for getting me there!

NSString *myString = @"HelloWorld";
const char *stringAsChar = [myString cStringUsingEncoding:[NSString defaultCStringEncoding]];

Hope this helps someone in the future!

+2  A: 

See NSString class reference - you're probably interested in Getting Characters and Bytes and Getting C Strings sections.

Vladimir
Thanks, should have gone there first! ;)
ing0