I am invoking a C/C++ program (exe) from C#, I want to return a float value from my C/C++ to the C# code, I have the exe code which writes file a for a single value, instead I want to return that value to C#. How can I do that?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could output the result of your C/C++ program to the standard output, and then parse it with C# after the invokation.
Check this answer: Best Way to call external program in c# and parse output
Or if your program is called a lot a time, maybe a better solution would be to let it run and communicate with your C# program through local sockets. C# program may send request by network and get the result back.