I've been a developer for almost thirty years now (OMG am I really that old?), but have never really done much in C. Finally now I have a project where I can't avoid it
The platform is a LinkSys NSLU2 "Slug", running uNSLUng V2.3R63-uNSLUng-6.8 to HDD, with a Velleman K8055 interface board hanging off a USB port, and I'm writing code to interact with the outside world through this board. Running GCC v3.3.5.
So far, so good. I found a command-line binary for the K8055 which works great - you give it a command an it returns a line of text to the console, telling you what state all the inputs are in. Like this:
Obviously my control code needs to know what the output was. I've solved the problem by sending the output to a file, rather than the stdout console:Code:$ k8055 -P:2 -D:64 11;0;134;136;0;0
then opening and reading that file within the code. And this works. It just seems very clunky, not to mention horribly slow.Code:$ k8055 -P:2 -D:64 > status.txt
Is there a way I can call that external program, and catch its output, without going via a file? Sorta..... route THAT programs stdout to stdin so that I can grab it?
Just to make life really interesting... the control program (my code) runs as a service, although I'm negotiable on that if it gets in the way.
I'd also eventually like to re-mash the K8055 code and incorporate it into my own stuff, but right now I can't even compile it (dependancy issues?), and I'll save that one for another day. Right now I'd be happy just to dump the text-file-route I'm currently using.