添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
memset ( buf , 0 , sizeof ( buf ) ) ; if ( ( fd = open ( argv [ 1 ] , O_WRONLY | O_CREAT | O_TRUNC , 0666 ) ) < 0 ) perror ( "open" ) ; return - 1 ; while ( fgets ( buf , 20 , stdin ) != NULL ) if ( strcmp ( buf , "quit\n" ) == 0 ) break ; write ( fd , buf , strlen ( buf ) ) ; close ( fd ) ; return 0 ; #include &lt;stdio.h&gt;#include &lt;fcntl.h&gt;#include &lt;unistd.h&gt;#include &lt;string.h&gt;#define N 128int main(int argc, const char *argv[]){ int fd; char buf[N] = { 0 }; memset(buf, 0, sizeof(buf)); if ((fd = open