delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/20/09:29:55

Date: Sat, 20 Oct 2001 15:24:48 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: Geoff Cox <geoff DOT cox AT cableinet DOT co DOT uk>
Message-Id: <7458-Sat20Oct2001152448+0200-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <2ir2tt48fffbe6fchgd693t0s8t40h3e60@4ax.com> (message from Geoff
Cox on Sat, 20 Oct 2001 12:36:49 GMT)
Subject: Re: hwo to run prog using "program files" etc ??
References: <7se2ttccpk5u9g6223hmp6jvl9c17m15lo AT 4ax DOT com> <1659-Sat20Oct2001121534+0200-eliz AT is DOT elta DOT co DOT il> <2ir2tt48fffbe6fchgd693t0s8t40h3e60 AT 4ax DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Geoff Cox <geoff DOT cox AT cableinet DOT co DOT uk>
> Newsgroups: comp.os.msdos.djgpp
> Date: Sat, 20 Oct 2001 12:36:49 GMT
> 
> >surrounded by quotes.  So you should use the following string in your
> >program:
> >
> > char *call = "\"c:\\program files\\javasoft\\jre\\1.1\\bin\\jre.exe\"";
> 
> I've tried this - it compiles OK but when I run it nothing happens!?

Did you look at the value returned by the library function `system'?
I bet it's -1, which means your pathname is incorrect (i.e. the named
program does not exist).  That's hardly ``nothing happens'' ;-)

Or maybe you forgot to double some backslash.

Anyway, I just tried the simple program attached below (after
replacing the program's pathname with something that is correct for my
system), and it did work.

> I've also tried
> 
> char *call = "c:\\\"program files\"\\javasoft\\jre\\1.1\\bin\\jre";
> 
> but then get "unmatched quote character" when I run it...

One more evidence that some backslash somewhere was forgotten.

#include <stdlib.h>

char *call = "\"c:\\program files\\javasoft\\jre\\1.1\\bin\\jre.exe\"";

int main (void)
{
  return system (call);
}

- Raw text -


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