开发者

Return a value to external invoker C++

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 re开发者_开发技巧turn that value to C#. How can I do that?


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.


If that code writes a float to a file, then all you can do is read the file afterwards.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜