您的位置:首页 > 其它

dup函数简单应用

2011-04-14 20:54 253 查看
/* ************************************************************************
*       Filename:  02_dup.c
*    Description:
*        Version:  1.0
*        Created:  2011年04月14日 20时47分52秒
*       Revision:  none
*       Compiler:  gcc
*         Author:  wenhao (wh), hnrain1004@gmail.com
*        Company:  sunplusapp
* ************************************************************************/

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
int fd;
char str[]="hello world/n";
fd = dup(fileno(stdout));

write(fd,str,strlen(str));
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: