我正在使用Raspbian,这是我在Linux环境中高级C编程练习的一部分。我必须打开一个目录并列出它的内容,检查条目是子目录还是文件。"Error: unable to open directory\n");}
struct stat filestat(strcmp(entry->d_name,"..") == 0)){
stat(entry->d_name, &filesta
所以我有这样一段代码,它通过启动raspberry PI来显示目录中的所有文件:"./Readdir /etc“。我需要修改它,以便它也打印文件的大小。我尝试添加另一个打印语句,该语句打印结构的大小,如下所示:printf(sb.st_size),sb被声明为struct stat sb,但这只打印目录本身的大小。有人知道怎么帮我吗?提前感谢! /* Readdir.c - Read the current working directory */
#include <errno.h>
#include <st