hasmet
asked on
CFileFind question
CFileFind has FindFile() and FindNextFile() and GetFileName()
member functions. I would like to do
CFileFind finder;
finder.FindFile("*.h");
// NEXT GetFileName can not be used since it can be used
// only after callinf FindNextFile().
AfxMessageBox(finder.GetFi leName(),M B_OK);
while(finder.FindNextFile( ))
{
AfxMessageBox(finder.GetFi leName(),M B_OK);
}
but how do I get the name of my first wildcard file. so
I cannot call gefiletname if findnextfile is not called before.
I cannot call findnextfile if findfile is not called before.
But I need to get the first filename. Please do not guess
an answer, I need a working answer
member functions. I would like to do
CFileFind finder;
finder.FindFile("*.h");
// NEXT GetFileName can not be used since it can be used
// only after callinf FindNextFile().
AfxMessageBox(finder.GetFi
while(finder.FindNextFile(
{
AfxMessageBox(finder.GetFi
}
but how do I get the name of my first wildcard file. so
I cannot call gefiletname if findnextfile is not called before.
I cannot call findnextfile if findfile is not called before.
But I need to get the first filename. Please do not guess
an answer, I need a working answer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I do not think so, it will give you one less than total # of ".h" files
in the current dir. I believe the only way is to use the mfc help sample
like :
CFileFind finder;
BOOL bWorking = finder.FindFile("*.h");
while (bWorking)
{
bWorking = finder.FindNextFile();
AfxMessageBox(finder.GetFi leName(),M B_OK);
}
you did exactly what I did (I put the first message box to illustrate, it will
give you ASSERTIONS and crash). but thanks for trying
in the current dir. I believe the only way is to use the mfc help sample
like :
CFileFind finder;
BOOL bWorking = finder.FindFile("*.h");
while (bWorking)
{
bWorking = finder.FindNextFile();
AfxMessageBox(finder.GetFi
}
you did exactly what I did (I put the first message box to illustrate, it will
give you ASSERTIONS and crash). but thanks for trying
ASKER
sorry my server had a problem sending
ASKER
in the current dir. I believe the only way is to use the mfc help sample
like :
CFileFind finder;
BOOL bWorking = finder.FindFile("*.h");
while (bWorking)
{
bWorking = finder.FindNextFile();
AfxMessageBox(finder.GetFi
}
you did exactly what I did (I put the first message box to illustrate, it will
give you ASSERTIONS and crash). but thanks for trying