I am working on a "searching" program. But it always returns a "." as the up directory or whatever. And I can't do an if statement to check if its a period or not.
The goal is to get the only name of the folder in that directory. There is only 1 folder but the name always changes. If you have a better way of doing this please tell.
WIN32_FIND_DATA FindProfileName;
HANDLE hFind;
char *filepath;
char *foldername;
//...Other Code Here to set filepath
hFind = FindFirstFile(filepath, &FindProfileName);
if (FindProfileName.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
FindClose(hFind);
foldername = FindProfileName.cFileName;
printf("\nFolder: %s", foldername);
if(foldername == ".")
{
printf("\nPeriod Returned\n");
}
}
Thanks in advance.
FIXED
Since the folder always ends in a "t" I added *t so it would search for anything that has a t at the end.