📄 myfind.h
字号:
#include<sys/types.h>#include<dirent.h>#include<unistd.h>#include<stdio.h>void myfind(char *str1,char *str2){ if(isdir(str1)==0&&isfile(str1)==0) printf("%s is not a file or file directory!/n",str1); if(isdir(str1)==1) { if(strcmp(str2,"")!=0) { int flag=0; char *childdir; DIR *dp; struct dirent *dirp; dp = opendir(str1); while((dirp=readdir(dp))!=NULL) { if(strcmp(str2,dirp->d_name)==0) { printf("File %s is in the %s\n",str2,str1); flag=1; } } if(flag==0) printf("File %s is not found\n",str2); } } if(isfile(str1)==1) { if(strcmp(str2,"")==0) { char buf[80]; getcwd(buf,sizeof(buf)); int flag=0; char *childdir; DIR *dp; struct dirent *dirp; dp = opendir(buf); while((dirp = readdir(dp))!=NULL) { if(strcmp(str1,dirp->d_name)==0) { printf("File %s is in the %s\n",str1,buf); flag=1; } } if(flag==0) printf("File %s is not found\n",str1); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -