JustJeff
JustJeff

Reputation: 12980

WinMain command line arguments

The 3rd param to WinMain provides the command line as an unprocessed string. While that may be useful for allowing you to cope with expansion of wildcards and what-not, is there any chance that lurking somewhere in the Win32 API that there's a way to get the usual C argc, argv version of it?

Upvotes: 7

Views: 9978

Answers (3)

newman911
newman911

Reputation: 303

microsoft speciffic:

__argc and __argv

Upvotes: 13

Adam Rosenfield
Adam Rosenfield

Reputation: 400274

You can use CommandLineToArgvW() to convert to an argv-style array of Unicode strings. Unfortunately, there is no ANSI-string version. Also, beware that this does not set argv[argc] (i.e. the element after the last argument) to NULL.

Upvotes: 7

Shea
Shea

Reputation: 11243

CommandLineToArgvW()

Upvotes: 2

Related Questions