B.M.Ashok B.M.Ashok - 2 months ago 18x
C++ Question

Linux : C# (read) and C++ (write) Inter Process communication Sample Code

I am using Unity in Linux and want to read data which is generated at runtime from a hardware upon executing c++ executable file

I have used Files where c++ writes to a file and C# reads from it , but its slow due to I/O operations

Can I get a sample code which can help me read c++ data from c# code

I have looked at all the codes. All of them are for WIndows
Is there any samples for Linux ?


Perhaps writing to STDOUT in your C++ app, piping it into your C# app and reading from STDIN in it is the most suitable inter process communication option for you:

cpp_app | csharp_app

In your C++ app simply use std::cout for output (or whatever you prefer for writing to STDOUT).

In your C# app you may use Process class. I provided examples in this post: http://stackoverflow.com/a/38739406/4295017. These are for Windows but should work on Linux in similar way with Mono (you're using it, aren't you?).