Mail Archives: djgpp/1999/09/16/14:35:13
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 -