Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

question: passing a command line argument into program

Status
Not open for further replies.

hoggle

Programmer
Jul 13, 2001
124
US
I need to pass a path into my application so I can set a media player to play the passed in file.
I have to run the program through the command line can someone help me with passing a string in from teh commadn line?
thanks
 
your main should be desinged as

int main(int argc, char** argv)


If you put command line arguments on the command line, argc will be greater then one and all command line arguments will be in argv[1 thru argc-1]

If you are only passing the directory, all you need to worry about is argv[1]

Matt
 
sorry I didn't make myself 100% clear I'm doing a MFC application I saw in the MSDN that you use

int wmain( int argc[ , wchar_t *argv[ ] [, wchar_t *envp[ ] ] ] );

but I can't figure out how to use it
thanks for the help so far
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top