Attempts to read `n` bytes starting at the current file offset from the open file referred to by `f`. Bytes read are stored in the memory buffer at address `b` which must be at least `n` bytes in size. The function advances the file offset by the amount read, and returns the number of bytes actually read, 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. If an end-of-file condition is detected prior to reading any bytes, the function will ensure that `!ec` is `true` and the return value shall be 0.
Attempts to read `n` bytes starting at the current file offset from the open file referred to by `f`. Bytes read are stored in the memory buffer at address `b` which must be at least `n` bytes in size. The function advances the file offset by the amount read, and returns the number of bytes actually read, 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. If an end-of-file condition is detected prior to reading any bytes, the function will ensure that `!ec` is `true` and the return value shall be 0.