Shells normally use globbing. The glob function is easy to call.
Consider:
Code:
#include <stdlib.h>
#include <glob.h>
int main(int argc, char *argv[])
{
glob_t globbuf;
int i=0;
if(glob (argv[1], 0, NULL, &globbuf)==GLOB_NOMATCH)
return 1;
while(i<globbuf.gl_pathc)
{
printf("%s\n", globbuf.gl_pathv[i++]);
}
globfree(&globbuf);
return 0;
}