delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/09/30/16:55:58

Message-ID: <37F3B148.8D5BC224@softhome.net>
Date: Thu, 30 Sep 1999 20:51:52 +0200
From: Laurynas Biveinis <lauras AT softhome DOT net>
X-Mailer: Mozilla 4.61 [en] (Win98; I)
X-Accept-Language: lt,en
MIME-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
CC: djgpp-workers AT delorie DOT com
Subject: Re: Help with arg passing
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990930133520 DOT 20873I-100000 AT is>
Reply-To: djgpp-workers AT delorie DOT com

Eli Zaretskii wrote:
> Try the modified test.c below, and you will see the long file name in
> argv[0].

But the puzzle doesn't end, I have:
file test.c:
#include <stdlib.h>

int main(void)
{
   system("VeryLongName.exe"
          " 1234567890 1234567890 1234567890 1234567890 234567890"
/*          " 1234567890 1234567890 1234567890 1234567890 1234567890"
          " 1234567890 1234567890" */);
   return 0;
}
-----------
file VeryLongName.c:
-----------
#include <stdio.h>

int main(int argc, char *argv[])
{
        printf("Hello from VeryLongName.exe!\n");
        printf("%s\n", argv[0]);
        return 0;
}
-----------
If I run test, I get:

Hello from VeryLongName.exe!
c:/djgpp/programs/djgpp/verylong.exe

Correct. But If delete '/*' and '*/' from test.c to
enable long command line, I get:

Hello from VeryLongName.exe!

And argv[0] is _not_ printed.
Is this expected behaviour ?

Laurynas Biveinis

- Raw text -


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