| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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 |
| Date: | Fri, 10 Sep 2004 12:37:37 -0500 (Central Daylight Time) |
| From: | "David A. Rogers" <darogers AT speakeasy DOT net> |
| To: | Dave Korn <dk AT artimi DOT com> |
| Cc: | cygwin AT cygwin DOT com |
| Subject: | RE: cygwin 1.5.11: execv doesn't set argv[0] on Windows programs |
| In-Reply-To: | <NUTMEGspH2q6DqaJY4k000012dd@NUTMEG.CAM.ARTIMI.COM> |
| Message-ID: | <Pine.WNT.4.44.0409101230520.956-100000@drogers2k.spss.com> |
| X-Warning: | UNAuthenticated Sender |
| MIME-Version: | 1.0 |
| X-IsSubscribed: | yes |
On Fri, 10 Sep 2004, Dave Korn wrote:
> There is no concept of argv in the windows OS itself. The application gets the
> entire commmand line as one unparsed string.
>
Actually, this is not true. Even in a true win32 app, argc and argv are
available, they are just not as obvious. The following program will print
the location of the exe.
---------------------------------------------------------------------------
#include "stdafx.h"
#include "stdlib.h" // for __argc and __argv
#include "stdio.h" // for sprintf
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char msg[300];
sprintf(msg, "%d args. Arg0 is %s", __argc, __argv[0]);
MessageBox(NULL, msg, "argv test", MB_OK);
return 0;
}
---------------------------------------------------------------------------
--
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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |