getCString(_:maxLength:)
Invokes Getcstring(_:maxlength:range:remaining:) with maxLength as the maximum length in char-sized units, the receiver’s entire extent as the range, and NULL for the remaining range.
Declaration
func getCString(_ bytes: UnsafeMutablePointer<CChar>, maxLength: Int)Discussion
buffer must be large enough to contain maxLength chars plus a terminating zero char (which this method adds).
Raises an NSCharacterConversionException if the receiver can’t be represented in the default C-string encoding without loss of information. Use canBeConverted(to:) if necessary to check whether a string can be losslessly converted to the default C-string encoding. If it can’t, use lossyCString() or data(using:allowLossyConversion:) to get a C-string representation with some loss of information.
See Also
Related Documentation
Deprecated
string(withCString:)init(CString:)string(withCString:length:)init(CString:length:)init(CStringNoCopy:length:freeWhenDone:)string(withContentsOfFile:)init(contentsOfFile:)string(withContentsOf:)init(contentsOfURL:)write(toFile:atomically:)write(to:atomically:)getCharacters(_:)cString()lossyCString()cStringLength()