Originally posted by sebythomas
passing arguments and calling the program works with all other arguments except the ones where wild characters are used
That's correct. Wildcards are processed by a shell, and exec..()-functions do not run the command inside a shell. This would be a chicken-egg problem, as shells themselves are written in C and need exec..() to run other processes....
Use system() instead of one of the exec..()-functions. System() does run the program inside a shell.
If you cannot use system(), because its functionality is too limited for you purpose, check out these functions (ordered from most sophisticated, to most basic):
man 3 wordexp
man 3 glob
man 3 scandir + man 3 fnmatch
man 3 opendir + man 3 readdir + man 3 fnmatch
Hope this helps.