From: Haynes AT pwrh DOT com (Haynes, Dan) Subject: RE: argc/argv 15 Jan 1999 01:09:03 -0800 Message-ID: <83A5B9068368D211BDE90060B06A21BA45AADD.cygnus.gnu-win32@bozeman.pwrh.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" To: shijn AT tcc DOT com DOT cn, gnu-win32 AT cygnus DOT com When using Borland C++, link with wildcards.obj (in V5.02 it's c:\borlandc\lib\32bit\wildargs.obj or c:\borlandc\lib\16bit\wildargs.obj) and your application will work the same under DOS/Win32 as the Unix version. Wildargs.obj simply expands wildcards in file specifications somewhat like bash.exe does. The one gotcha with that scheme - if no files match the wildcard, Borland just passes in the arguments untouched. So if you invoke your program as "test *.c" and there are no .c files in the directory, argv[1] will be set to "*.c" :-( Hope that helps, Dan Haynes > -----Original Message----- > From: shijn AT tcc DOT com DOT cn [mailto:shijn AT tcc DOT com DOT cn] > Sent: Thursday, January 14, 1999 4:24 AM > To: gnu-win32 AT cygnus DOT com > Subject: argc/argv > > > Hi! Evidently gcc treats argc/argv quite differently from > Turbo C when * appears in any argvs. It always tries to > replace this argv with as many as possible matching files. > For example, > > main(int argc, char *argv[]) > { int i; > for (i=1; i } > > Run it with t*.c as the command argument, > > Compiled with GCC, it prints: > argv[1]=Test.c > argv[2]=Text2html.c > argv[3]=Timezone.c > > Compiled with Turbo C, it prints: > argv[1]=t*.c > > i know nothing about any standard or coding conventions > about this, but could any of you tell me which is more > standard or conventional? > > J. Shi > > - > For help on using this list (especially unsubscribing), send > a message to > "gnu-win32-request AT cygnus DOT com" with one line of text: "help". > - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".