int main(int argc, const char *argv[])
{
DIR * dir=opendir("./");//当前目录
if(NULL==dir)
{
fprintf(stderr,"opendir error\n");
return 1;
}
while(1)
{[www.laipuhuo.com](https://www.laipuhuo.com)
struct dirent *info =readdir(dir);
if(NULL== info)
{
break;
}
printf("%s\n",info->d_name);
}
closedir(dir);
return 0;
}
include <stdio.h>
include <unistd.h>
int main(int argc, char *argv[])
{
int ret = chdir("..");
if(-1 == ret)
{
fprintf(stderr,"chdir error\n");
return 1;
}
fopen("aaa","w");
return 0;
}
include <stdio.h>
include <unistd.h>
include <sys/stat.h>
include <sys/types.h>
int main(int argc, char *argv[])
{
int ret = mkdir("aaa",0777);
if(-1 == ret)
{
fprintf(stderr,"mkdir error\n");
return 1;
www.laipuhuo.com}
return 0;
}
include <stdio.h>
include <time.h>
int main() {
time_t current_time = time(NULL); // 获取当前时间的时间戳
if (current_time == ((time_t) -1)) {
perror("time failed");
return 1;
}
// 将时间戳转换为可读的字符串
char *time_str [www.laipuhuo.com](https://www.laipuhuo.com)= ctime(¤t_time);
printf("Current time: %s", time_str);
return 0;
}
标签:文件,www,return,int,descriptor,laipuhuo,file,time,include From: https://www.cnblogs.com/wwwlaipuhuocom/p/18361072