dup2
int dup2(int oldfd,newfd);
use
duplicate the file descritpor oldfd to newfd
return code
return the copy of the file descriptor on sucess or return -1 and set errno on error
EBADF
oldfdis not open or don’t existEBADF
newfdis aready open or don’t existEIO
an IO error happend while duplicatingfd