?
Solved

Redirect output to a file in VC++

Posted on 2003-02-24
5
Medium Priority
?
444 Views
Last Modified: 2008-02-01
I want to run a dos based programm with 2 considerations under VC++.
1. There is no popup screen (This is easy using SW_HIDE).
*2. Redirect the output of the program to a file.
The problem is that CreateProcess, ShellExecute can not redirect the output of the program to a File (or it does that I don't know). Can anyone suggest anything?
0
Comment
Question by:riyafath
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 2

Expert Comment

by:emalagar
ID: 8012072
Hi riyafath :

Did you try to create .bat file that executes the program and performs the redirection, and then execute the .bat file instead from CreateProcess or ShellExecute.

0
 

Expert Comment

by:nanden
ID: 8015771
Reassign a file pointer.

FILE *freopen( const char *path, const char *mode, FILE *stream );

FILE *_wfreopen( const wchar_t *path, const wchar_t *mode, FILE *stream );

for more information, see the freopen function is MSDN.
HTH,
0
 
LVL 1

Expert Comment

by:vadik
ID: 8017958
There is topin in MSDN "Creating a Child Process with Redirected Input and Output". I did it half year ago... but this way having another problem... if your hide-process suddenly are waiting for input he is going to suspend of indefinite time. Sorry for my English.
0
 
LVL 1

Accepted Solution

by:
vadik earned 100 total points
ID: 8017973
There is topic in MSDN "Creating a Child Process with Redirected Input and Output". I did it half year ago... but this way having another problem... if your hide-process suddenly are waiting for input he is going to suspend of indefinite time. Sorry for my English.
0
 

Expert Comment

by:CleanupPing
ID: 9474633
riyafath:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question