I want to execute the following shell comand inside a C program:
find <folder_name> -name "*.bin" | wc -l
and store the result in a variable which I have declared inside my program. I don't want the result that indicates if the command executed succesfully, I want the result that tells me how many files ending in .bin exist in my directory. The following code obciously is not working.
char command[10];
command = system("find <folder_name> -name \"*.bin\" | wc -l")
I need to pass the <folder_name>
as a command line argument.
How can I accomplish both of these tasks ? I would really appreciate any help.