请输入您要查询的百科知识:

 

词条 fdopen
释义

§ 解释

函数名: fdopen

功 能: 把流与一个文件句柄相接

用 法: FILE *fdopen(int handle, char *type);

§ 程序例

#include <sys\\stat.h>

#include <stdio.h>

#include <fcntl.h>

#include <io.h>

int main(void)

{

int handle;

FILE *stream;

/* open a file */

handle = open("DUMMY.FIL", O_CREAT,

S_IREAD | S_IWRITE);

/* now turn the handle into a stream */

stream = fdopen(handle, "w");

if (stream == NULL)

printf("fdopen failed\");

else

{

fprintf(stream, "Hello world\");

fclose(stream);

}

return 0;

}

随便看

 

百科全书收录594082条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/3/8 3:52:37