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"
- int main(int argc, char *argv[])
- {
- DIR *pDIR;
- struct dirent *pDirEnt;
- pDIR=opendir(".");
- if(pDIR==NULL)
- {
- fprintf(stderr, "%d: opendir() failed (%s)\n", __FILE__, __LINE__, strerror(errno));
- exit(-1);
- }
- pDirEnt=readdir(pDIR);
- while(pDirEnt!=NULL)
- {
- printf("%s\n", pDirEnt->d_name);
- pDirEnt=readdir(pDIR);
- }
- close(pDIR);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment