Linux下c/c++创建文件夹及文件权限设置,非root权限,指定一下权限进行创建
char szfn[4096];
char m_path[4096];
getcwd(m_path, sizeof(m_path));
sprintf(m_path + strlen(m_path), "/log");
mkdir(m_path, 0775);
sprintf(szfn, "%stest.log", m_path);
int fd = open(szfn, O_CREAT | O_RDWR | O_APPEND | O_LARGEFILE, 0664);