丹调生活 发表于 2019-1-27 15:18:47

0301使用open函数编写一个程序

  使用open函数编写一个程序,打开或者创建一个指定的文件,带路径文件名由用户指定输入,文件名的最长长度为30.
#include
#include
#include
#include
#include
#include
#include
  #define FLAGS O_WRONLY|O_CREAT|O_TRUNC
#define MODE S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH
  int main(int argc, char argv[])
{
const char pathname;//指向需要打开(或创建)文件的绝对路径名或相对路径名
int fd;//文件描述符
char pn;//pn为字符串数组,存放要打开的文件名
printf("input the pathname[
页: [1]
查看完整版本: 0301使用open函数编写一个程序