init(contentsOfFile:)
Initializes the receiver, a newly allocated NSString object, by reading data from the file named by path.
Declaration
convenience init?(contentsOfFile path: String)Discussion
Initializes the receiver, a newly allocated NSString object, by reading data from the file named by path. If the contents begin with a byte-order mark (U+FEFF or U+FFFE), interprets the contents as UTF-16 code units; otherwise interprets the contents as data in the default C string encoding. Returns an initialized object, which might be different from the original receiver, or nil if the file can’t be opened.
See Also
Related Documentation
Deprecated
string(withCString:)init(CString:)string(withCString:length:)init(CString:length:)init(CStringNoCopy:length:freeWhenDone:)string(withContentsOfFile:)string(withContentsOf:)init(contentsOfURL:)write(toFile:atomically:)write(to:atomically:)getCharacters(_:)cString()lossyCString()cStringLength()getCString(_:)