I'm trying to use someone else's [c] code that controls a linux shell over a wireless usb device. It fopen-s files "IReadFromBash" and "IWriteToBash" in the current dir to communicate. It comes with no notes but obviously expects a special file to already exist to facilitate this, and segfaults without them. Is there some obvious way to create named in- and out-files that connect to a shell?
+2
A:
Really just a guess on my part but I suspect they'll be named pipes, created with mknod
. That seems to me the best way to achieve the desired goal.
You can see this in operation here. From a terminal session:
pax> mknod infile p
pax> mknod outfile p
pax> bash <infile >outfile
Then, from another terminal:
pax> echo ls >infile
pax> cat outfile | sed 's/^/ /'
backup0.sh
backup1.sh
Desktop
Downloads
infile
Music
outfile
Pax
Pictures
Public
super_sekrit_porn
Templates
Videos
workspace
pax> _
paxdiablo
2010-06-21 06:34:12
ah-ha! Thank you!
phip
2010-06-21 06:46:03