searching directories in windows

Started by
10 comments, last by gowron67 21 years, 2 months ago
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..
Advertisement
findfirstfile.
For Win32 stuff it''s always good to have a look at MSDN.

[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || [email=lektrix@barrysworld.com]E-Mail Me[/email] ]
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
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
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 ]
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || [email=lektrix@barrysworld.com]E-Mail Me[/email] ]
Slightly adapted from MSDN....


    #define _WIN32_WINNT 0x0400#include "windows.h"intmain(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]
cheers NickB, exactly what I was looking for.
lektrix.....what are you doing in sunny brighton ? are you a pro. coder ?
Heh, no, I''m at school, learning (supposedly). What you doing?

[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || [email=lektrix@barrysworld.com]E-Mail Me[/email] ]
just got a job as a games programmer....it''s pretty tough, need to learn a lot

This topic is closed to new replies.

Advertisement