I have a python-based program that reads serial data off an a port connected to an rs232 cable. I want to pass the data I get here to a C-program that will handle the computation-intensive side of things. I have been checking up the net and all I’ve found are linux-based.
Share
Use a pipe and popen
The easiest way to deal with this is probably to just use
popen(3). Thepopenfunction is available in both Python and C and will connect a program of either language with the other using a pipe.Once you have the pipe, you should probably send yaml or json through it, though I’ve never tried to read either in C. If it’s really a simple stream, just parse it yourself. If you like XML, I suppose that’s available as well.