Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <dirent.h>
- #include <errno.h>
- #include <sys/types.h>
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- #include <fcntl.h>
- #include <stdlib.h>
- #include <unistd.h>
- #define BUFFER_SIZE 1024
- int main(){
- char folder_name[254];
- DIR *d;
- char buffer[BUFFER_SIZE];
- struct dirent *dir;
- d = opendir("/proc");
- char s1[254];
- if(d){
- printf("PID CMD \n");
- while((dir = readdir(d)) != NULL){
- if(folder_name[0] > '0' && folder_name[0] < '9'){
- printf("%s", dir->d_name);
- strcpy(s1, "/proc/");
- strcpy(s1, dir->d_name);
- }
- }
- closedir(d);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement