🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.msdos.programmer
1 messages
1 total messages Started by Floyd Miller Sat, 10 Mar 1990 21:42
Re: Redirecting output of DOS batch files
#1304
Author: Floyd Miller
Date: Sat, 10 Mar 1990 21:42
38 lines
1999 bytes
I appreciate the responses both via email and followup articles.
The use of COMMAND /C certainly satisfies the problem in my
original posting: redirecting the output from a batch file.
The ensuing discussion on the use of the /C option with EXEC
and SPAWN was also interesting.

A second operation I discovered I needed was a way to redirect
the stderr output.  Unix shells provide the means to accomplish
this but apparently not COMMAND.COM.

Using the examples of EXEC to invoke COMMAND.COM from within a C
program I am writing a REDIR program which will combine stderr
with stdout so both can be redirected to the same place.  At least
that partially solves the problem.  I'm not worried right now about
redirecting them separately.  Once I'm finished I'll submit it to
C.B.I.P for posting - if I can figure out how to do that.

I found a problem with the code posted for exec'ing COMMAND.COM.  Using:

      execlp("COMMAND.COM", "/C", cmd_string, NULL);

starts up COMMAND.COM interactively and results in an error message:

      Specified MS-DOS search directory bad.

I discovered, experimentally that what is required is:

      execlp("COMMAND.COM", "COMMAND.COM", "/C", cmd_string, NULL);

so that the 1st argument passed to COMMAND.COM is its name.
I hope this helps anyone else whose had a similar problem.

*******   *****************************************
*****  ************************* Floyd Miller
***  *************** floyd@starsend.UUCP
*  ********* floyd%starsend@PRC.Unisys.com
  *** starsend!floyd@burdvax.PRC.Unisys.com
*
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads