Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- #include "sys/types.h"
- #include "dirent.h"
- #include "errno.h"
- #include "string.h"
- #include "stdlib.h"
- #include "sys/stat.h"
- int main(int argc, char *argv[]){
- struct stat st;
- DIR *pDIR;
- int size;
- struct dirent *pDirEnt;
- pDIR=opendir (".");
- if(pDIR==NULL){
- fprintf(stderr, "%s %d:opendir() failed (%s)\n", __FILE__, __LINE__,strerror(errno));
- exit(-1);}
- pDirEnt=readdir(pDIR);
- while(pDirEnt !=NULL){
- printf("%s ", pDirEnt->d_name);
- stat(pDirEnt->d_name, &st);
- size = st.st_size;
- printf("%d bajtow \n", size);
- pDirEnt=readdir(pDIR);}
- closedir(pDIR);
- return 0;
- }
- //ls -l
- //ls -R
- // +3 dowolne inne opcje
- //ls -l /etc podanie katologu wywołania
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement