you can find the code in so many unix applications. most of the unix app's takes wild card searches. look into the source code of any small application. like ls, grep, find etc etc.. you can even debug them and understand how they are working.
Your reply looks quite surprising to me Jsmith. This exactly means, if i am writing an application which takes some parameters, i don't have to implement wild cards in my program.
yes JSmith you are correct. Wild Characters are implemented in shell only. I have tested with this code:
1 2 3 4 5 6
int main(int argc, char** argv)
{
std::cout << "Number of chars supplied :" << argc << std::endl;
return 0;
}
now run this prog with ./a.out D*
Here is the output:
Number of chars supplied :3
This when i have 2 directories starting with 'D'.
make sure that there are more than 1 filename/directory in your current directory. The answer shall be > 2, which means that the program is getting more arguments than actually provided.
Harsh:
As you want to implement this then you will get all the parameters in your 'argv' variable and you have to use a loop and then handle all those accordingly.
I want to implement wildcard searching in c. Please tell me how to do it. Or where to start for this problem.
Where to start for this problem? Try giving more information about what you are wanting to achieve. Just saying you want to implement wild-card searching doesn't give a lot of information.