Background: Some Windows command-line programs allow to use *.*
in their 1st argument:
myprogram *.*
and will automatically loop on all files of the directory.
Some others don't, thus requiring a batch loop:
for %%c in ("*.*") do myprogram "%%c"
Question: Is there a standard way (defined in the C language or provided by OS?) to allow *.*
or *.txt
in the argument, so that it would do the processing automatically on the relevant files?
int main(int argc, char *argv[])
{
FILE *kf;
"for fname in argv[1]" // pseudo code here meaning:
// let's loop on all files described by the first argument
{
kf = fopen(fname, "rb");
...
}
}
I wanted to check if a solution for this exists, before rolling my own (reinventing the wheel of wildcard expansion, using FindFirstFile, etc.)