Our website is made possible by displaying online advertisements to our visitors.Please consider supporting us by disabling your ad blocker.
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Translate it in your own Language

Print this Job Post

Print Friendly and PDF

Sunday, May 18, 2014

C program to list files in directory

This program list all files present in a directory/folder in which this executable file is present. For example if this executable file is present in C:\\TC\\BIN then it will lists all the files present in C:\\TC\\BIN.

C programming code(Turbo C compiler only)

#include <stdio.h>
#include <conio.h>
#include <dir.h>
int main()
{
   int done;
   struct ffblk a;
   clrscr();
   printf("Press any key to view the files in the current directory\n");
   getch();
   done = findfirst("*.*",&a,0);
   while(!done)
   {
      printf("%s\n",a.ff_name);
      done = findnext(&a);
   }
   getch();
   return 0;
}
Obviously you will get a different output when you will execute this file on your computer.

No comments:

Post a Comment

Copyright @ CrackMNC 2014-2024
Divas Nikhra Theme by Crack MNC