写个简单程序,基本写明了整体的流程,不明的函数百度就好了。
#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.txt", O_CREAT,
S_IREAD | S_IWRITE);
/* now turn the handle into a stream */
stream = fdopen(handle, "w");
if (stream == NULL)
printf("fdopen failed\n");
else
{
fprintf(stream, "Hello world\n");
fclose(stream);
}
return 0;
}
复制不了????
关键是那几个函数,打开文件函数,录入函数,关闭函数,这些都是能百度到的,我只是给你举个程序,让你知道是怎么一个过程。真正理解还要靠你自己努力。
温馨提示:答案为网友推荐,仅供参考