How to get result or output of ShellExecute?

I am writing a MFC program to control RCS (Revision Control System from GNU).

The path has been set correctly.

The command I use is this

::ShellExecute ( NULL, _T("open"), _T("ci"), _T("-x,v -t-\"Initial Revision\" c:\\abc.txt c:\\temp\\RCS\\abc.txt,v"), NULL, SW_SHOW );

This corresponds to the DOS command:
  ci -x,v -t-"Initial Revision" c:\\abc.txt c:\\temp\\RCS\\abc.txt,v
This DOS command can be executed correctly.

The return value is 42.

The DOS window disappears very quickly, so I can't see the output of "ci" command.

The problem is when I executes this command from my MFC program, the file is not checked in. But I don't know what happened during command execution.

I also try to put "> c:\\result.txt" at the end of parameter, want to put output in a ASCII file. But the result.txt is not created at all.

So is there some solution to capture the output of command execution or let the DOS window stay even after command is done so I can see the output?

Thanks

-David
LVL 2
htang_usAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
>>I also try to put "> c:\\result.txt" at the end of parameter

This is because the output redirection is done by the shell, so that should be

cmd.exe /c   ci -x,v -t-"Initial Revision" c:\\abc.txt c:\\temp\\RCS\\abc.txt,v > c:\\result.txt

Actually, your problem seems to be that you are not using the .exe extension like e.g.

::ShellExecute ( NULL, _T("open"), _T("ci.exe"), _T("-x,v -t-\"Initial Revision\" c:\\abc.txt c:\\temp\\RCS\\abc.txt,v"), NULL, SW_SHOW );

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
htang_usAuthor Commented:
Thanks a lot, jkr,

That perfectly solve my question.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.