Returns a file handle initialized for reading the file, device, or named socket at the specified URL.
- iOS 4.0+
- macOS 10.6+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
The URL of the file, device, or named socket to access.
If an error occurs, upon return contains an
NSErrorobject that describes the problem. Pass
NULLif you do not want error information.
The initialized file handle object or
nil if no file exists at
The file pointer is set to the beginning of the file. You cannot write data to the returned file handle object. Use the
read methods to read data from it.
When using this method to create a file handle object, the file handle owns its associated file descriptor and is responsible for closing it.