How to parse windows command line

Elfyn McBratney elfyn-cygwin@exposure.org.uk
Thu Apr 24 18:34:00 GMT 2003


> Here is the code that is relevant to the problem:
> 
> int WINAPI WinMain
> (
>     HINSTANCE,
>     HINSTANCE,
>     LPSTR pszArguments,
>     int
> )
> {
>     std::string strTitle(pszArguments);
>     ...
> 
> 
> If I compile this with the Borland compiler and then lauch the program 
> from bash using:  ./Program.exe Filename, then pszArguments (and 
> consequently strTitle) just equals "Filename".
> 
> If I compile with Cygwin and launch the file the same way, pszArguments 
> equals something like:  "Directory\\Directory\\Program.exe\" Filename "
> 
> pszArgument doesn't even contain the full path to the executable.  It 
> starts partway through the path name, containing only the ending portion 
> of one of the directories in the path name.
> I don't really care about the executable path name.  All I want is the 
> filename, like what I get when I compile with Borland or Microsoft.

This

<http://www.cygwin.com/ml/cygwin/2003-04/msg00451.html>

might help you out.

Elfyn

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list