Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <inttypes.h>
- #include <string.h>
- #include <stdlib.h>
- int main()
- {
- char file_name[PATH_MAX];
- uint64_t result = 0;
- struct stat t;
- char* nl;
- while( fgets(file_name, sizeof(file_name)), stdin ) {
- nl = memchr(file_name, '\n', sizeof(file_name));
- if (nl) {
- *nl = '\0';
- }
- if (-1 != lstat(file_name, &st)) {
- if (S_ISREG(st.st_mode)) {
- result += st.st_size;
- }
- }
- }
- printf("%"PRIu64"\n", result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement