delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/16/14:35:13

Date: Thu, 16 Sep 1999 13:40:47 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Klaus Reinhardt <K DOT Rdt AT TU-Berlin DOT DE>
cc: dl mailing list <djgpp AT delorie DOT com>
Subject: Re: How to redirect?
In-Reply-To: <37E1145F.3F16@TU-Berlin.DE>
Message-ID: <Pine.SUN.3.91.990916133701.7952Q-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 16 Sep 1999, Klaus Reinhardt wrote:

> ----------------- mailto:K DOT Rdt AT TU-Berlin DOT DE start -------------------
> Hello!
> 
> It's a Pascal(fpc)-program, but perhaps someone from this group could
> help.
> 
>         exec('c:\g32\bin\ls.exe',' -l y > log');
> gives:
>         c:/g32/bin/ls: >: No such file or directory (ENOENT)

This is expected: you invoke `ls' with " -l y > log" as its single 
argument.  What you need is this:

	exec('c:\g32\bin\ls.exe','-l', 'y');

This doesn't include the redirection, because the redirection cannot be 
passed through `exec' (I think; I don't really know Pascal all that well).
Either use the equivalent of C's function `system', or try this:

	exec('c:\dos\command.com', ' /c c:\g32\bin\ls.exe -l y > log');

(Note that I didn't test that, so it might be wrong.)

- Raw text -


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