Mail Archives: djgpp/1998/10/28/21:37:41
The zr0 wrote:
>
> how do i use wildcards? Ive already wrote my own generic
> substitutes for dos commands, but they are really lacking
> w/o them.
They're used automatically on the command line, they just may not be the
kind you're used to. Do:
#include <stdio.h>
int main(int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i++)
printf("%s\n", argv[i];
return 0;
}
Compile and run it with the argument "*", and look at what you get.
See also FAQ sections 16.1 through 16.3. If you want to expand
arbitrary strings this way, use the `glob' function.
If you really want traditional DOS wildcards (a big step down IMHO), you
can probably use `findfirst' and `findnext'.
Note that GNU fileutils exist, which is a package of programs with
similar but much better functionality than DOS commands, though with a
slightly different interface. You might check it out if you want such
tools to use them, instead of as practice in writing them.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -