www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/28/21:37:41

Sender: nate AT cartsys DOT com
Message-ID: <3637E1A3.D71B7BF@cartsys.com>
Date: Wed, 28 Oct 1998 19:31:47 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.35 i486)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: wildcards
References: <19981027163012 DOT 17624 DOT 00000100 AT ng146 DOT aol DOT com>
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019