delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/16/12:40:41

From: horst DOT kraemer AT snafu DOT de (Horst Kraemer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How to redirect?
Date: Thu, 16 Sep 1999 11:38:36 GMT
Organization: [Posted via] Interactive Networx
Message-ID: <37e0bebc.38635490@news.snafu.de>
References: <37E1145F DOT 3F16 AT TU-Berlin DOT DE>
NNTP-Posting-Host: n164-172.berlin.snafu.de
X-Newsreader: Forte Free Agent 1.11/32.235
Lines: 29
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Thu, 16 Sep 1999 09:01:35 -0700, Klaus Reinhardt
<K DOT Rdt AT TU-Berlin DOT DE> 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 neither a C problem nor a Pascal problem but a problem of
interfacing DOS.

EXEC is a wrapper for the DOS EXEC function which executes the program
_instead_ of COMMAND.COM. Redirection is a service of the command
processor. EXEC expects the parameters to the program and not the
parameters to COMMAND.COM. You would have to call the program via the
command processor.


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


Regards
Horst

- Raw text -


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