Yes it is possible to do directory listing using C.
I hope this will suffice. No need for explaination !

#include <stdio.h>
#include <dir.h>

int main(void)
   struct ffblk ffblk;
   int done;
   printf("Directory listing of *.*\n");
   done = findfirst("*.*",&ffblk,0);
   while (!done)
      printf("  %s\n", ffblk.ff_name);
      done = findnext(&ffblk);

   return 0;
struct ffblk is a structure storing all the relevant parameters required to list a directory. Use help in C for more details.
findnext function call returns the next file in the directory

Comments as always welcomed !

Last edited by shabbir; 1Jul2007 at 23:44.. Reason: Code block -