delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/21/07:52:38

From: Martin Ambuhl <mambuhl AT earthlink DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How do I pass * (astrix) over argv ?
Date: Tue, 21 Sep 1999 03:01:25 -0400
References: <7s6rjn$gq7$1 AT nnrp1 DOT deja DOT com>
X-Posted-Path-Was: not-for-mail
X-Accept-Language: en
X-ELN-Date: 21 Sep 1999 06:59:23 GMT
X-ELN-Insert-Date: Tue Sep 21 00:05:11 1999
Organization: Nocturnal Aviation
Lines: 45
Mime-Version: 1.0
NNTP-Posting-Host: dialup-209.246.107.148.newyork2.level3.net
Message-ID: <37E72D45.F1430B42@earthlink.net>
X-Mailer: Mozilla 4.61 [en] (Win95; U)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


hank_heng AT hotmail DOT com wrote:
> 
> Hello,
> 
>   I'm using DJGPP, and I notice that if I do something like this :
> 
>   myprog *.*
> 
>   *.* actually copy all available file name that found in that
> directory and store it in argv[1], argv[2], argv[3] ... and so on...
> 
>   I don't want this to happen, so how do I pass '*.*' over the command
> line and receive '*.*' in argv[1] instead of bunches of file names.
> 

#include <stdio.h>

int main(int argc, char *argv[])
{
    printf("argc = %d\n"
            "If argc > 0, argv follows:\n", argc);
    
    while (*argv) 
        printf("%s\n",*argv++);
    return 0;
}



>a '*.*'

argc = 2
If argc > 0, argv follows:
./a.exe
*.*


-- 
Martin Ambuhl	mambuhl AT earthlink DOT net

__________________________________________________________
Fight spam now!
Get your free anti-spam service: http://www.brightmail.com

- Raw text -


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