C Program To List Files In A Folder Or Directory
♣ Try it Out ::
#include<stdio.h>
#include<conio.h>
#include<dir.h>
main()
{
int done;
struct ffblk a;
printf("Press any key to view the files \n");
getch();
done = findfirst("*.*", &a, 0);
printf("The files are: \n\n");
while( ! done)
{
printf("%s\n", a.ff_name);
done = findnext(&a);
}
getch();
return(0);
}
♣ Output ::
Press any key to view the files The files are: CPROGR~1.HTM CPROGR~2.HTM CPROGR~3.HTM CPROGR~1.EXE
♣ Downloads ::
Comments
Post a Comment