Please help. I got a code that finds all folder, subfolders and files in given directory. And now I need to write them in XML document. Could it be possible without using parser? What should I add?
void PrintDir(char *parm)
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
char buffer[MAX_PATH];
char path[MAX_PATH];
strcpy(path, parm);
strcat(path, "*.*");
hFind = FindFirstFile(path, &FindFileData);
do
{
if (!strcmp(FindFileData.cFileName, ".") || !strcmp(FindFileData.cFileName, ".."))
continue;
if (FindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
{
strcpy(buffer, parm);
strcat(buffer, FindFileData.cFileName);
printf("%s\n", buffer);
strcat(buffer, "\\");
PrintDir(buffer);
}
else
{
strcpy(buffer, parm);
strcat(buffer, FindFileData.cFileName);
printf("%s\n", buffer);
}
}while(FindNextFile(hFind, &FindFileData));
FindClose(hFind);
}