[C] 打开一个文件用于读或写 →→→→→进入此内容的聊天室

来自 , 2020-01-08, 写在 C, 查看 126 次.
URL http://www.code666.cn/view/ae1eaa32
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <fcntl.h>
  4. #include <io.h>
  5.  
  6. int main(void)
  7. {
  8.    int handle;
  9.    char msg[] = "Hello world";
  10.  
  11.    if ((handle = open("TEST.$$$", O_CREAT | O_TEXT)) == -1)
  12.    {
  13.       perror("Error:");
  14.       return 1;
  15.    }
  16.    write(handle, msg, strlen(msg));
  17.    close(handle);
  18.    return 0;
  19. }
  20.  

回复 "打开一个文件用于读或写"

这儿你可以回复上面这条便签

captcha