#include <glob.h>
#include <stdio.h>
int main()
{
glob_t pglob;
int i;
if (glob("abc/testdir.*", GLOB_ERR, NULL, &pglob) != 0)
{
printf("Failed to load from abc folder!\n");
return -1;
}
for (i = 0; i < pglob.gl_pathc; i++)
{
char file_name[256];
#ifdef DEBUG
printf("(%d/%d) %s is loading...\n", i + 1, pglob.gl_pathc, pglob.gl_pathv[i]);
#endif
strcpy(file_name, pglob.gl_pathv[i]);
}
globfree(&pglob);
return 0;
}