原创 dup函數(文件編程)

dup和dup2用來複制文件描述符。   函數原型: #include int dup(int oldfd); int dup2(int oldfd,int newfd);            dup用來複制oldfd所指的文件描述符。