This topic has not yet been rated Rate this topic

Expanding Wildcard Arguments

Microsoft Specific

When running a C program, you can use either of the two wildcards — the question mark (?) and the asterisk (*) — to specify filename and path arguments on the command line.

Command-line arguments are handled by a routine called _setargv (or _wsetargv in the wide-character environment), which by default does not expand wildcards into separate strings in the argv string array. You can replace the normal _setargv routine with a more powerful version of _setargv that does handle wildcards by linking with the Setargv.obj file. If your program uses a wmain function, link with Wsetargv.obj.

To link with Setargv.obj or Wsetargv.obj, use the /link option. For example:

cl typeit.c /link setargv.obj

The wildcards are expanded in the same manner as operating system commands. (See your operating system user's guide if you are unfamiliar with wildcards.)

END Microsoft Specific

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
With Visual studio Please ?
Most people do not call linker from command line, so it would be helpfull to write how this can be done using Visual Studio 2010.

with VS2008 it is done:
Edit manually .vcproj
and:
            <Tool
                Name="VCLinkerTool"
                AdditionalOptions="setargv.obj"
                OutputFile="XXXX"
                LinkIncremental="2"
                GenerateDebugInformation="true"
                ProgramDatabaseFile="XXXX"
                SubSystem="1"
                RandomizedBaseAddress="1"
                DataExecutionPrevention="0"
                TargetMachine="1"
            />