i have make scan for deepest level for local client , i do not have a clue how to switch for UDP connection, please help.
#pragma warning(disable : 4996)
#include "Scan API.h"
//**************************************************************
typedef struct
{
int nDeepestLevel;
char sDeepestDirectory[MAX_PATH+1];
}
DEEPEST_LEVEL_INFO;
//**************************************************************
BOOL DeepestDirectory(int nLevel, const char* pPath, const WIN32_FIND_DATA* pFD, void* pParam)
{
DEEPEST_LEVEL_INFO* pDLI = (DEEPEST_LEVEL_INFO *)pParam;
if (nLevel == pDLI->nDeepestLevel)
{
pDLI->nDeepestLevel = nLevel + 1;
strcat(strcat(strcpy(pDLI->sDeepestDirectory, pPath), "\\"), pFD->cFileName);
}
return TRUE;
}
//**************************************************************
int GetLongestDirectoryChain(const char* pPath, char* pChain)
{
//* Initialize globals
DEEPEST_LEVEL_INFO dli;
dli.nDeepestLevel = 0;
dli.sDeepestDirectory [0] = 0;
//* Start scanning
Scan(pPath, DeepestDirectory, 0, &dli);
strcpy(pChain, dli.sDeepestDirectory);
return dli.nDeepestLevel;
}
//**************************************************************
Also, make Scan API.h for order scan the file (findfirst, findnext...).