Link to home
Start Free TrialLog in
Avatar of longjumps
longjumps

asked on

C/C++ programming - redirect stdin and stdout to files

Need example of C/C++ program that can run another executable and redirect its stdout and stderr to files.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of longjumps
longjumps

ASKER

jrk, thanks.

How can I compile
system("cmd.exe /c file.exe 1>&2 output.txt");

in MS Visual Studio 2010?

It seems C code, isn't?

It is not passing compile.

What I am doing wrong?

/ ddProxyEXE.cpp : main project file.

#include "stdafx.h"

using namespace System;

int main(array<System::String ^> ^args)
{
    Console::WriteLine(L"Hello World");

    system("cmd.exe /c file.exe 1>&2 output.txt");

    return 0;
}

in MS VS 2010
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks guys,

I am checking.