나는 dirent.h를을 사용하여 Windows 경로에있는 모든 파일과 하위 디렉토리를 표시하기 위해 노력하고있어이 지금까지 내 코드입니다 :왜 이러한 점은 나타나지 않습니다 (C++ dirent.h를)
void print_dir(char* path, char* subdir)
{
char full_path[MAX_PATH];
concat_path(full_path, path, subdir);
DIR *dir;
struct dirent *ent;
if ((dir = opendir (full_path)) != NULL) {
/* print all the files and directories within directory */
while ((ent = readdir(dir)) != NULL) {
if(is_dir(full_path, ent->d_name)){
printf ("DIR %s\\%s\n",full_path, ent->d_name);
print_dir(full_path, ent->d_name);
}
else{
printf ("%s\\%s\n",full_path, ent->d_name);
}
}
closedir (dir);
} else {
/* could not open directory */
perror ("");
}
}
나는 D : \ test에 각각의 파일이있는 두 개의 하위 디렉토리가 있고 함수가 무한 재귀에서 멈추고 \.\.\.\.\.\.
무한대로 표시됩니다. 이름이 "."인지 확인하기 위해 조건을 입력하면. 또는 ".."그리고 아무것도하지 않을 경우 모든 것이 계획대로 작동합니다. 그렇다면이 점들은 무엇입니까?
http://stackoverflow.com/questions/8411931/what-does-dot-and-dotdot-means – user2120666
점과 점에 대한 이름을 확인하는 것이 좋은 습관인지 또는 다른 조치를 취해야한다고 말할 수 있습니까? – user2419750