功 能: 打开一个文件用于读或写用 法: int open(char *pathname, int access[, int permiss]); 程序例:[mw_shl_code=c,true]#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
int main(void)
{
int handle;
char msg[] = "Hello world";
if ((handle = open("TEST.$$$", O_CREAT | O_TEXT)) == -1)
{
perror("Error:");
return 1;
}
write(handle, msg, strlen(msg));
close(handle);
return 0;
}
[/mw_shl_code]
|