I trying to get size of files in a directory by using dirent.h headers. However
stat(ent->d_name, &statbuf)
returns always -1 and I can’t get the size properly. What could be the reason?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
d_namecontains the name of the file within that directory.statwants a name including the directory part, unless it’s the current directory.Make a temporary string containing the full path to the
d_namefile.EDIT: Sample