小编Hir*_*rah的帖子

'.' 是什么意思 在 c 中表示作为 opendir 的参数?

“这是代码。'.'是什么意思 里面“opendir('.')”是否指定到当前目录?

#include <stdio.h> 
#include <dirent.h> 
int main(void) 
{ 
struct dirent *de;  // Pointer for directory entry 

// opendir() returns a pointer of DIR type.  
DIR *dr = opendir("."); 

if (dr == NULL)  // opendir returns NULL if couldn't open directory 
{ 
    printf("Could not open current directory" ); 
    return 0; 
} 


while ((de = readdir(dr)) != NULL) 
        printf("%s\n", de->d_name); 

closedir(dr);     
return 0; 
} 
Run Code Online (Sandbox Code Playgroud)

c operating-system

2
推荐指数
1
解决办法
79
查看次数

标签 统计

c ×1

operating-system ×1