|
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
#include <string.h>
int main(int argc,char **argv)
{
char path[10];
DIR *dirp;
memset(path,0,10);
strcpy(path,"/home");
if((dirp=opendir(path))==NULL);
{
printf("3456");
perror("opendir");
exit(1);
}
printf("1234");
closedir(dirp);
return 0;
}
结果是
opendir: Success
3456
为什么opendir执行不成功呢?我怎样才能让他正常打开这个目录?
麻烦大家帮帮我,谢谢! |
|