can someone tell me how can i list all the .txt files of a directory or folder by a c++ program.
please tell .
i have tried
void f_ListFile()
{
system("cls");
system("DIR /b D:\\*.txt");
getch();
}
it is working for this but when it is something like this below
void f_ListFile()
{
system("cls");
//system("DIR D:\\ /P /A:-D-H /O:N -E*.txt");
system("DIR /b C:\Documents and Settings\malaya\My Documents\Visual Studio 2008\\*.txt");
getch();
}
then this fails ...
i know the reason that when in command it is given DIR then it wont go inside the folders ... and thats all the problem that i have to go into a folder..
so please help me