C语言程序---linux下创建文件夹

1.C语言判断文件是否存在
用函数access,原型:
  
int   access(const   char   *filename,   int   amode);

amode参数为0时表示检查文件的存在性,如果文件存在,返回0,不存在,返回-1。

2.#include <sys/stat.h>
#include <sys/types.h>
int mkdir(const char *pathname, mode_t mode);
参数: 
pathname:新目录路径名。
mode:访问权能(mode & ~umask &0777)。

   创建的时候是在文件夹flow下 所以路径为“flow // XXX.txt”的形式。因为时间开始的时候是在txtname.txt里面的,而路径是在pathname中存储的,所以要用数组将两个字符串连接起来

猜你喜欢

转载自blog.csdn.net/lwhsyit/article/details/3079651