Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,
i want to pass string data to running C# console application process from C++ code.
I know how to pass arguments to a process whom we are going to run but i do not know how to pass data to running C# console application process from C++ code.
Posted
Updated 2-Apr-13 22:53pm
v2

1 solution

It depends on how you plan to spawn the C# process, for simplest case you may use system function to spawn(execute) the C# console, in this case you may simply pass the arguments as a string.
<br />
    system("MyConsole.exe arg1 arg2");<br />


Oh! I was completely wrong. Seems I didn't get your point. If you want to send arguments to a C# process while it's running you should spawn the C# console from the C++ with redirected stdin ad stdout. This can only be done by CreateProcess function. So if you manage to spawn the C# application in this way you may simply write arguments to it's stdin.
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900