MCPcopy Create free account
hub / github.com/arun11299/cpp-subprocess / write_n

Function write_n

cpp-subprocess/subprocess.hpp:643–653  ·  view source on GitHub ↗

! * Function: write_n * Writes `length` bytes to the file descriptor `fd` * from the buffer `buf`. * Parameters: * [in] fd : The file descriptotr to write to. * [in] buf: Buffer from which data needs to be written to fd. * [in] length: The number of bytes that needs to be written from * `buf` to `fd`. * [out] int : Number of bytes written or -1 in case of fa

Source from the content-addressed store, hash-verified

641 * [out] int : Number of bytes written or -1 in case of failure.
642 */
643 static inline
644 int write_n(int fd, const char* buf, size_t length)
645 {
646 size_t nwritten = 0;
647 while (nwritten < length) {
648 int written = subprocess_write(fd, buf + nwritten, length - nwritten);
649 if (written == -1) return -1;
650 nwritten += written;
651 }
652 return nwritten;
653 }
654
655
656 /*!

Callers 1

execute_childMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected