write

WRITE(2)                   Linux Programmer's Manual                  WRITE(2)



NAME
       write -å¨ä¸åæ件æ述符ä¸å·è¡å¯«æä½

æ¦è¿°
       #include <unistd.h>

       ssize_t write(int fd, const void *buf, size_t count);

æè¿°
       write åæ件æ述符 fd æå¼ç¨çæ件ä¸å¯«å¥ å¾ buf éå§çç·©è¡åä¸ count å‐
       ç¯çæ¸æ.  POSIXè¦å®,ç¶ä½¿ç¨äºwrite()ä¹å¾å使ç¨
       read(),é£éº¼è®åå°çæ該æ¯æ´æ°å¾çæ¸æ.  ä½è«æ³¨æ並ä¸æ¯ææçæ件系統é½æ¯
       POSIXå¼å®¹ç.

è¿åå¼
       æåæè¿åæ寫å¥çåç¯æ¸(è¥ç²é¶å表示æ²æ寫å¥æ¸æ).
       é¯èª¤æè¿å-1,並置errnoç²ç¸æå¼.
       è¥countç²é¶,å°æ¼æ®éæ件ç¡ä»»ä½å½±é¿,ä½å°ç¹æ®æ件 å°ç¢çä¸å¯é æçå¾æ.

é¯èª¤ä»£ç¢¼
       EBADF  fd ä¸æ¯ä¸ååæ³çæ件æ述符æèæ²æ以寫æ¹å¼æé.

       EINVAL fd ææåçå°è±¡ä¸å¯å¯«.

       EFAULT buf ä¸å¨ç¨æ¶å¯è¨ªåå°å空éå§.

       EPIPE  fd é£æ¥å°ä¸å管é,æèå¥æ¥åçè®æ¹åä¸ç«¯å·²éé.æ¤æ寫é²ç¨ å°æ¥æ¶å°
              SIGPIPE ä¿¡è;å¦ææ¤ä¿¡è被æç²,é»å¡æ忽ç¥,é£éº¼å°è¿åé¯èª¤ EPIPE.

       EAGAIN è®æä½é»å¡,ä½ä½¿ç¨ O_NONBLOCK æå®äºéé»å¡å¼è¼¸å¥è¼¸åº.

       EINTR  å¨å¯«æ¸æ以å調ç¨è¢«ä¿¡èä¸æ·.

       ENOSPC fd æåçæ件æå¨çè¨åç¡å¯ç¨ç©ºé.

       EIO    ç¶ç·¨è¼¯ä¸åç¯é»æç¼çäºåºå±¤è¼¸å¥è¼¸åºé¯èª¤.

       å¯è½ç¼çäºå¶ä»é¯èª¤,åæ±ºæ¼ fd æé£æ¥çå°è±¡.

å¼å®¹æ¼
       SVr4, SVID, POSIX, X/OPEN, 4.3BSD.  SVr4ææªæ·»å äºä»¥ä¸é¯èª¤ä»£ç¢¼:
       EDEADLK, EFBIG, ENOLCK, ENOLNK, ENOSR, ENXIO, EPIPE,æèERANGE.
       å°æ¼SVr4æå¯è½å¨å¯«å¥é¨åæ¸ææç¼çä¸æ·ä¸¦è¿åEINTR.

åè¦
       open(2), read(2), fcntl(2), close(2), lseek(2), select(2), ioctl(2),
       fsync(2), fwrite(3)


[ä¸æçç¶è·äºº]
       byeyear <love_my_love@263.net >

[ä¸æçææ°æ´æ°]
       2002.02.07

ãä¸ålinuxè«å£manæåé ç¿»è¯è¨åã:
       http://cmpp.linuxforum.net

è·
       æ¬é é¢ä¸æçç±ä¸æ man æåé è¨åæä¾ã
       ä¸æ man æåé è¨åï¼https://github.com/man-pages-zh/manpages-zh



Linux 2.0.32                    13 January 1996                       WRITE(2)