List files in a folder but only files that starts with a number
I am trying to make a program that can scan a folder, and then list all files that starts with a number. Please help
I am trying to base my idea in this example code.
Code:
int main(void)
{
DIR *d;
struct dirent *dir;
d = opendir("/directory");
if (d)
{
while ((dir = readdir(d)) != NULL)
{
printf("%s\n", dir->d_name);
}
closedir(d);
}
return(0);
}
The above program prints all files in a directory. Can someone help me how to filter the list files so then it will only print files starting with numbers?