stringWithContentsOfFile:encoding:error:
Returns a string created by reading data from the file at a given path interpreted using a given encoding.
Declaration
+ (instancetype) stringWithContentsOfFile:(NSString *) path encoding:(NSStringEncoding) enc error:(NSError **) error;Parameters
- path:
A path to a file.
- enc:
The encoding of the file at
path. For possible values, see Nsstringencoding. - error:
If an error occurs, upon returns contains an
NSErrorobject that describes the problem. If you are not interested in possible errors, pass inNULL.
Return Value
A string created by reading data from the file named by path using the encoding, enc. If the file can’t be opened or there is an encoding error, returns nil.