Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   write.3p    ( 3 )

написать в файл (write on a file)

Примеры (Examples)

Writing from a Buffer
       The following example writes data from the buffer pointed to by
       buf to the file associated with the file descriptor fd.

#include <sys/types.h> #include <string.h> ... char buf[20]; size_t nbytes; ssize_t bytes_written; int fd; ... strcpy(buf, "This is a test\n"); nbytes = strlen(buf);

bytes_written = write(fd, buf, nbytes); ...