Attempts to write `n` bytes from the buffer pointed to by `c` to the current file offset of the open file referred to by `f`. The memory buffer at `c` must point to storage of at least `n` bytes meant to be copied to the file. The function advances the file offset by the amount written, and returns the number of bytes actually written, which may be less than `n`. If `f` does not refer to an open file, the function will set `ec` to `errc::invalid_argument` and return immediately. The function will ensure that `!ec` is `true` if there was no error or set to the appropriate error code if an error occurred.
Attempts to write `n` bytes from the buffer pointed to by `c` to the current file offset of the open file referred to by `f`. The memory buffer at `c` must point to storage of at least `n` bytes meant to be copied to the file. The function advances the file offset by the amount written, and returns the number of bytes actually written, which may be less than `n`. If `f` does not refer to an open file, the function will set `ec` to `errc::invalid_argument` and return immediately. The function will ensure that `!ec` is `true` if there was no error or set to the appropriate error code if an error occurred.