fshearer
March 14th, 2005, 03:03 PM
I am just learning C++ I was wondering if someone can point me in the right direction to enumerate files in a directory in a win32 console app. I am using Visual Studio 02 .net as a IDE. This is what I have so far, and if someone can help, can you explain how you did it. Thanks greatly appreciated
#include <iostream>
using namespace System;
using namespace System::IO;
using namespace std;
//Function Prototypes
int menu();
int DoTaskHelp();
int AllFiles();
int main()
{
bool exit = false;
for(;;)
{
int choice = menu();
switch(choice)
{
case (1):
DoTaskHelp();
break;
case (2):
exit = true;
break;
case (3):
AllFiles();
}//end switch
if (exit)
break;
}//end forever
return 0;
}
int menu()
{
int choice;
cout << "\t**********\n \t MENU\n\t**********\n***Created by F. Shearer***\n\n";
cout <<"(1) Help. \n";
cout <<"(2) Exit. \n";
cout <<"(3) Search. \n";
cout << " ";
cin >> choice;
return choice;
}
int DoTaskHelp()
{
cout <<"No help info at this time!\n\n";
return 0;
}
int AllFiles()
{
int drive;
//Choose drive and dispaly directories
cout <<"Enter Drive you want to search: ";
cin >> drive;
//drive to search directories
DirectoryInfo* Info = new DirectoryInfo();
return 0;
}
#include <iostream>
using namespace System;
using namespace System::IO;
using namespace std;
//Function Prototypes
int menu();
int DoTaskHelp();
int AllFiles();
int main()
{
bool exit = false;
for(;;)
{
int choice = menu();
switch(choice)
{
case (1):
DoTaskHelp();
break;
case (2):
exit = true;
break;
case (3):
AllFiles();
}//end switch
if (exit)
break;
}//end forever
return 0;
}
int menu()
{
int choice;
cout << "\t**********\n \t MENU\n\t**********\n***Created by F. Shearer***\n\n";
cout <<"(1) Help. \n";
cout <<"(2) Exit. \n";
cout <<"(3) Search. \n";
cout << " ";
cin >> choice;
return choice;
}
int DoTaskHelp()
{
cout <<"No help info at this time!\n\n";
return 0;
}
int AllFiles()
{
int drive;
//Choose drive and dispaly directories
cout <<"Enter Drive you want to search: ";
cin >> drive;
//drive to search directories
DirectoryInfo* Info = new DirectoryInfo();
return 0;
}