At 3/8/2010 10:08 AM, you wrote:

>--- In [email protected], "Sam" <glo...@...> wrote:
> >
> >
> >
> > --- In [email protected], "John" <jm5678@> wrote:
> > >
> > > --- In [email protected], "Sam" <glogic@> wrote:
> > > >
> > > > Hi All
> > > > I need some help finding file names with in a folder.
> > >
> > > Hi Sam - please could you show us your code so we can see 
> exactly what you are doing?
> > >
> >
> > Yup sure.
> >
> > WIN32_FIND_DATA FindFileData;
> > bool t = FindFirstFile("c:\\test\\*.*",&FindFileData);
> > string stuff = FindFileData.cFileName;
> >
> > when ever i try add the above as a code segment my browser 
> crashes for some reason so dont give out i tried. Literally i just 
> want to retrieve the name of what ever file it finds. then after 
> words ill loop it with findnextfile to get all the file names if i 
> can get it working that is. I have that test folder in place with a 
> file in there to retrieve but the cFileName i keep getting is just "."
> > what stupid mistake am i making?
> > thanks for help
> > g
> >
>
>ok its kinda working now. whenever i give the exact file extension 
>to look for its fine but not when im looking for all extensions?

Hi Sam,

When you use "*.*", you will always match the current directory (".") 
and the parent directory (".."). You will need to loop using 
FindNextFile and eliminate those two directories. You may also want 
to check the attributes of the entry you matched and eliminate ALL 
directory entries.

e.g. if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {}
~Rick 

Reply via email to