system() question
am 17.01.2006 18:59:14 von kelly
hi,
I'm trying to execute this...
system("include","../definitions/make_generic.defs");
sytem("$(XCC)", "$(XFLAGS)", "main.c", "encrypt.c", "decrypt.c");
where
$XCC = mycmd.exe, can be found at make_generic.defs
$XFLAGS = $(CFLAGS) -c $(COMPILER)
I'm getting an error with my system usage. Is what I'm trying to
to here even legal?
Re: system() question
am 17.01.2006 19:53:38 von Paul Lalli
kelly wrote:
> hi,
>
> I'm trying to execute this...
>
> system("include","../definitions/make_generic.defs");
> sytem("$(XCC)", "$(XFLAGS)", "main.c", "encrypt.c", "decrypt.c");
>
> where
> $XCC = mycmd.exe, can be found at make_generic.defs
> $XFLAGS = $(CFLAGS) -c $(COMPILER)
>
> I'm getting an error with my system usage.
And you don't think that maybe the text of that error message might be
somewhat important?
> Is what I'm trying to to here even legal?
I have no idea, because you haven't told us what your actual goal is.
You've just posted two lines of Perl code, one of which cannot possibly
compile.
I have no idea if $XCC, $XFLAGS, etc are supposed to be Perl variables
or Environment variables in your above code. That would be a pretty
important thing to specify, don't you think?
If they're perl variables, why are you surrounding them with ( )? What
do you think that does?
If they're environment variables, you need to either use Perl's access
to the environment variables, or prevent Perl from interpolating the $
in your double quoted string:
system('$(XCC)', '$(XFLAGS)', 'main.c', 'encrypt.c', 'decrypt.c');
system("\$(XCC)", "\$(XFLAGS)\", 'main.c', 'encrypt.c', 'decrypt.c');
system($ENV{XCC}, $ENV{XFLAGS}, 'main.c', 'encrypt.c', 'decrypt.c');
Choose one of the above three.
Paul Lalli