Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

gowron67

searching directories in windows

This topic is 5730 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how do you search a specified directory in windows32 ? is there a function that returns how many files and a list of their names or something similar ? i can''t find it anywhere in the documentation. thanks..

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Lektrix.....I happen to be in Brighton too ! I am looking at MSDN...and as usual, finding it hard to understand how to use FindFirstFile and FindNextFile properly

Share this post


Link to post
Share on other sites
Lektrix.....I happen to be in Brighton too ! I am looking at MSDN...and as usual, finding it hard to understand how to use FindFirstFile and FindNextFile properly

Share this post


Link to post
Share on other sites
quote:
Original post by gowron67
Lektrix.....I happen to be in Brighton too !

Hehe, cool!
quote:
Original post by gowron67
I am looking at MSDN...and as usual, finding it hard to understand how to use FindFirstFile and FindNextFile properly


I''m sorry, I would help you but I''m not a Win32 programmer. I don''t know anything about the different data types and so forth. You''ll have to find someone who is a Win32 programmer. Anyone?

[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]

Share this post


Link to post
Share on other sites
Slightly adapted from MSDN....


    
#define _WIN32_WINNT 0x0400

#include "windows.h"

int
main(int argc, char *argv[])
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;

// uses DOS style filters

hFind = FindFirstFile("*.exe", &FindFileData);

if(hFind != INVALID_HANDLE_VALUE) {
do {
// do something with the file here

printf("Found File : %s", FindFileData.cFileName;

// get the next file in the search sequence

} while( FindNextFile(hFile, &FindFileData) );

FindClose(hFind);
}

return (0);
}



[edited by - NickB on February 9, 2003 10:29:18 AM]

Share this post


Link to post
Share on other sites
cheers NickB, exactly what I was looking for.
lektrix.....what are you doing in sunny brighton ? are you a pro. coder ?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!