Hi
I am trying to create a map of file pairs... First I am searching a specified directory for files using the FindFirstFile and FindNextFile and when a file is found I search the map to see if the associated file is there. If the other file was added to the map, the new found file is inserted beside the previously found one. If an associated file was not found, the new file is inserted to the map and its pair is left intact.
To explain more: lets say we have 2 files file.1.a and file.1 those files represent a pair and thus should be added to the map as a pair
//map<File w/o .a, File w .a>
std::map<CString, CString> g_map;
int EnumerateFiles(LPCTSTR Dir)
{
//Search Files....
//Found a File....(for ex: file.1)
//Append .a to the string and search for it in the map
BOOL bAdded = FALSE;
for(std::map<CString, CString>::iterator itr = g_map.begin(); itr != g_map.end(); itr++)
{
if(StrCmp(tchAssocFile, itr->second) == 0)
{
bAdded = TRUE;
//pair the string with the other one;
}
}
if(!bAdded)
//Add the new string to the map and leave its associate blank
//Do the same in reverse if the associate was found first....
}
I hope this was clear as I can't think of any other way to put it... sry.
Can you please help in solving this issue...
regards