• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 345
  • Last Modified:

redirect _spawnl() to file

I'm using MSVC 1.52 to create a DOS app.
I'm trying to call a DOS program and redirect the output to a text file.  For example, from a DOS command line:
C:\PROG.EXE PARM1 > C:\TEMPFILE.TMP

The code I'm using is:
_spawnl(_P_WAIT, "C:\\PROG.EXE","PARM1 > C:\\TEMPFILE.TMP", NULL)

No error is returned from _spawnl, but the file does not contain the contents of program output.

Is it possible to do this? or am I calling _spawnl incorrectly?
0
garywilkinson
Asked:
garywilkinson
1 Solution
 
Answers2000Commented:
It is possible to redirect output of a child process to a file, but not ny using spawnl

DOS redirection is handled by the DOS shell thru some low level tinkering (spawnl doesn't know about this)

Under DOS this should work
system( "C:\\PROG.EXE PARAM1 > C:\\TEMPFILE.TMP" ) ;
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now