What class parses to get Main()'s args?

G

Guest

Hi,

For some test code I am writing, I want to convert a string of characters
that I would theoretically enter on the command line into the string array
that is passed to my program's Main() method.

For example, on the command line I may have:
c:>program.exe "This is a test"

Whatever calls Main() will call using an array with a single string rather
than four strings, because of the 3 spaces. Anyway, what is the parser
class/method that converts "This is a test" to the appropriate string args
array? I am looking to call Main() from a test class and to parse the
string entered on the virtual command line just as it is parsed into a string
array when executed from the command line.

Thanks,
Stuart
 
M

Mattias Sjögren

Stuart,
Anyway, what is the parser
class/method that converts "This is a test" to the appropriate string args
array?

There's no managed class that does that. It's done in the CLR startup
code (I haven't looked exactly how they do it, but they may be using
the CommandLineToArgvW API).



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top