/* * This function writes n bytes to the file * specified by descriptor fd copying them from * the memory area addressed by buf. */ #include ssize_t write(int fd, const void *buf, size_t n) { /* * - Check that fd is a valid descriptor */ /* * - Check that buf points to a valid memory area */ /* * - Check that n is a non-negative number */ /* * - Attempt to write the requested number of bytes */ /* * - Return number of bytes actually written, -1 in * case of error. */ }