Date: Thu, 16 Sep 1999 13:40:47 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Klaus Reinhardt cc: dl mailing list Subject: Re: How to redirect? In-Reply-To: <37E1145F.3F16@TU-Berlin.DE> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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.)