Keith Adler
Keith Adler

Reputation: 21178

NSMutableString to char *

Hot can I convert an NSMutableString to char *?

e.g.

NSString* someval = @"This is a test.";
NSMutableString *temp = [NSMutableSTring stringWithString:someval];
char * temp2 = ????Not sure what to do here???;

Upvotes: 1

Views: 2307

Answers (1)

Jacob Relkin
Jacob Relkin

Reputation: 163308

Use the -UTF8String method:

NSString* someval = @"This is a test.";
NSMutableString *temp = [NSMutableString stringWithString:someval];
const char * temp2 = [temp UTF8String];

Upvotes: 6

Related Questions