Contents

write(from:startingAt:length:)

Synchronously writes data from from a buffer to the resource and executes a block afterwards.

Declaration

func write(from buffer: UnsafeRawBufferPointer, startingAt offset: off_t, length: Int) throws -> Int

Parameters

  • buffer:

    A buffer to provide the data.

  • offset:

    The offset into the resource from which to start writing.

  • length:

    A maximum number of bytes to write. The completion handler receives a parameter with the actual number of bytes write.

Return Value

The actual number of bytes written.

Discussion

This method is a synchronous version of writeFrom:startingAt:length:completionHandler:.

In some cases, this method performs a partial write. In this case, the return value is shorter than the requested length, and the error is set to nil.

See Also

Reading and writing data