delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/04/24/01:07:32

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <007f01c30a1f$6e950630$ac6786d9@ellixia>
From: "Elfyn McBratney" <elfyn-cygwin AT exposure DOT org DOT uk>
To: "cygwin" <cygwin AT cygwin DOT com>, "Tron Thomas" <tron DOT thomas AT verizon DOT net>
References: <3EA763E7 DOT 4090505 AT verizon DOT net>
Subject: Re: How to parse windows command line
Date: Thu, 24 Apr 2003 06:07:40 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

> I have written a Windows application that expects a file name as a
> command line argument.  If I compile the program with a either the
> Borland or Micrsoft compilers I get just the file name as the command
> line argument when I run the program.
>
> However if I compile the program with the Cygwin compiler I get some
> like the following for the command line argument when I run the program:
>
> "Directory\\Directory\\Program.exe\" Filename "

Need just a bit more information that that. What is the code you are using?
WinMain?

> This is make things akward.  I'm not sure why Cygwin is doing this when
> other compilers don't.
>
> Does Cygwin provide an API or other strategy to deal with this scenario?

Well, again that depends. My name is luke and I need to see the source. ;-)
For example, this mingw (AKA Windows native) application

--- CUT HERE ---
#include <stdio.h>

void
main (int argc, char **argv)
{
    printf ("My name is %s,\nHello, %s\n",
            argv[0] /* The program (executable file) name */,
            argv[1] ? argv[1] : "No name" /* First argument (if) passed to
the program */);
}
--- CUT HERE ---

Will print out the name of the program. On Cygwin

> My name is ./test1
> Hello, Zippy

and on Windows (from a command prompt)

> My name is G:\Cygwin\root\tmp\test1.exe
> Hello, George and Bungle

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019