C program to list files in directory


SUBMITTED BY: Guest

DATE: Jan. 21, 2014, 11:14 p.m.

FORMAT: Text only

SIZE: 418 Bytes

HITS: 1210

  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <dir.h>
  4. int main()
  5. {
  6. int done;
  7. struct ffblk a;
  8. printf("Press any key to view the files in the current directory\n");
  9. getch();
  10. done = findfirst("*.*",&a,0);
  11. while(!done)
  12. {
  13. printf("%s\n",a.ff_name);
  14. done = findnext(&a);
  15. }
  16. getch();
  17. return 0;
  18. }

comments powered by Disqus