Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fcntl.h>
- #include <stdio.h>
- #include <string.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <unistd.h>
- int main()
- {
- char name[1000];
- long long ans = 0;
- struct stat st;
- char* nl;
- while (fgets(name, sizeof(name), stdin)) {
- nl = memchr(name, '\n', sizeof(name));
- if (nl) {
- *nl = '\0';
- }
- if (-1 != lstat(name, &st) && S_ISREG(st.st_mode)) {
- ans += st.st_size;
- }
- }
- printf("%lld", ans);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement