![]() ![]() Printf("general_getFolderSize: Start\n") ![]() Int general_getFolderSize(char* folder, int* totalSize) * \param totalSize is a pointer where the result value is given * \param folder is the name of the folder (preferentially without a '/' at the end) ![]() * \brief general_getFolderSize returns the size of a folder in bytes. printf("general_getFolderSize: Item size (file) (%s): %d\n",fullPath,(int)buffer.st_size) If (readFolderSize(totalSize,fullPath) = EXIT_FAILURE)įprintf(stderr, "general_getFolderSize: Failed in stat (file) %s: %u\n", fullPath,err) printf("general_getFolderSize: Accessing dir: %s\n", fullPath) printf("general_getFolderSize: Is a directory: %s\n", dirData->d_name) Perror("general_getFolderSize: poDir fail!") įprintf(stderr, "general_getFolderSize: Failed in readdir (%u)\n",err) Int readFolderSize(int* totalSize, char* folder) Unfortunately none of them worked by themselves or were incomplete, so I had to improve them (merging one into the other) and I came to the following complete and working code-and-example (should be put inside a main.c file, the exact folder changed and then just run). I was just searching for a solution to this same problem when I encountered this thread and some others here on SO dealing with equal or similar problems (I found at the end 3 different codes aimed to calculate the total size of a folder with pure C). ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |