Contents

init(forUpdatingAtPath:)

Returns a file handle initialized for reading and writing to the file, device, or named socket at the specified path.

Declaration

convenience init?(forUpdatingAtPath path: String)

Parameters

  • path:

    The path to the file, device, or named socket to access.

Return Value

The initialized file handle object or nil if no file exists at path.

Discussion

The file pointer is set to the beginning of the file. The returned object responds to both read... messages and write(_:).

When using this method to create a file handle object, the file handle owns its associated file descriptor and is responsible for closing it.

See Also

Related Documentation

Creating a File Handle