File/Directory info in C++

B

bwilde

Hello,

I've come across a problem and I am hoping that somebody can help me.
Here is what I'd like to do:

I would like to have a bunch of images and subdirectories in a certain
directory (I know where the directory is with respect to where the
program is running), and I want to be able to find out what the names
of all of the images and subdirectories are from within my c++ program.

Has anybody come across this before? Any help would be greatly
appreciated.

Thanks,
Ben
 
G

Gurpreet Singh Mahi

Hello,

I've come across a problem and I am hoping that somebody can help me.
Here is what I'd like to do:

I would like to have a bunch of images and subdirectories in a certain
directory (I know where the directory is with respect to where the
program is running), and I want to be able to find out what the names
of all of the images and subdirectories are from within my c++ program.

Has anybody come across this before? Any help would be greatly
appreciated.

Thanks,
Ben

hello friend

to get info about directories u can use the keyword system
i have used it in c but not in c++
i think it will work

eg system("dir>>txt");
u can try;
 
J

JFalt

This is probably the direction you want to go in:
****dir is the string that is the root directory

doEntry(string dir)
{
WIN32_FIND_DATA findData;
HANDLE hFind=FindFirstFile((dir+"\\*.*").c_str(), &findData);
do
{
string sFileName(findData.cFileName);
LPCSTR lp(sFileName.c_str());
if(sFileName == "." || sFileName == "..")
{
//Do Nothing
}
else if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
//Do something with the directory
doEntry(dir+"\\"+sFileName);
}
else
//Do something with file
}while (FindNextFile(hFind, &findData));
}
 
Joined
Dec 28, 2007
Messages
1
Reaction score
0
Please help

Please someone tell what function to use to find the last modified date of a file .
At C++ . Not visual C++;

Thanks in advance for the answer .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,181
Messages
2,570,970
Members
47,537
Latest member
BellCorone

Latest Threads

Top