I am attempting to pass in and extract data from a C program from my node-red application. I have successfully been able to pass out data in my C program from stdout into node red but am unsure as to how to get data into my C program from node-red. Will I need to use some sort of inter process mechanism like linux d-bus etc?
Depends how complex the data is. For simple data, Colin's suggestion of command line parameters may be sufficient. For text-based but longer data, you could make your C++ app accept piped input from std-in.
For more complex data or better performance most of what you may choose to use would need you to turn your app into a daemon/service so that it could be listening on a port or pipe. Probably not what you want. You could also write your c++ code as a library and then wrap it with a Node.js module that could be used inside Node-RED.
You may wish to avoid platform-specific IPC though since that restricts what platforms you can run on - which may or may not be an issue for you.
The C application will be long running and sending floats, nothing too fancy. I would also like to send data (floats, ints etc) to the C program whilst its running so I don't think I would be able to pass that data into the C program using command line parameters. Hope that paints a better picture of what I'm trying to do.
In that case, Node-RED can use many different IPC methods - though I've never actually gotten round to trying UNIX pipes
But if you are happy to have another service running (the MQTT broker), certainly MQTT makes this pretty straight-forwards though at the cost of some bloat in your C++ app since you will need a suitable MQTT library linked or compiled in. But truthfully, if your C++ programme can create a TCP or UDP listener and sender, that might be enough. But MQTT will give you more flexibility of course and some pre-built structure to work with.
I'll experiment with both the MQTT approach first as this seems more straight forward than using UNIX pipes. I will however investigate using pipes as this seems to be more efficient, are there any resources you know that would help me get started with UNIX pipes?
Well they seem to be one of UNIX's (actually I think they may be a POSIX standard) better kept secrets. So I've never found a lot of information that didn't need a lot of head-scratching and re-reading
But I have played with them and got them working between Node.js apps in the past - my understanding is that Node-RED should also allow them in some places but I'm afraid that I've not tried.