函式說明:
- (const char *)cString
Returns a representation of the receiver as a C string in the default C-string encoding. The returned C string will be automatically freed just as a returned object would be released; your code should copy the C string or use getCString: if it needs to store the C string outside of the autorelease context in which the C string is created.
Raises an NSCharacterConversionException if the receiver can’t be represented in the default C-string encoding without loss of information. Use canBeConvertedToEncoding: if necessary to check whether a string can be losslessly converted to the default C-string encoding. If it can’t, use lossyCString or dataUsingEncoding:allowLossyConversion: to get a C-string representation with some loss of information.
Use of this method is discouraged as it will be deprecated in the near future. Instead it is recommended to use UTF8String to convert arbitrary NSStrings to a lossless 8-bit representation.
|