Home Overview FAQ Documentation Download Mailing List Geomview For Windows? Support Users Development Bug Reporting Contributing Contact Us Sponsors
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Closed REQ 6136]: Connecting Geomview with another X-application
FIFOs are one-directional: if you're writing to geomview through a FIFO, you can't get data back through the same FIFO. But, you can do this using *two* FIFOs and geomview's "command" GCL command. #include <sys/types.h> #include <sys/stat.h> FILE *togv, *fromgv; /* Ensure (more or less) that no one else is using these FIFOs */ unlink("/tmp/togv"); unlink("/tmp/fromgv"); mknod("/tmp/togv", S_IFIFO|0777, 0); mknod("/tmp/fromgv", S_IFIFO|0777, 0); /* Invoke geomview. Use the "command" command, which takes a pair of * file names; the first feeds commands to geomview, and the second * receives responses from geomview. Note that the FIFOs mentioned here * must exist before we start geomview. */ system("geomview -c '(command /tmp/togv /tmp/fromgv)' ... any other args ... &"); /* UNIX FIFO semantics imply that this will block until geomview starts. * If you don't entirely trust it to work, you might use * open( "/tmp/togv", O_WRONLY|O_NONBLOCK ) and a polling loop * that waited a few seconds for geomview to start, gave up if it didn't, * and otherwise used fdopen() to get a FILE pointer. * But this should work if all's well. */ togv = fopen("/tmp/togv", "w"); fromgv = fopen("/tmp/fromgv", "r"); fprintf(togv, "(interest (pick world))\n"); fflush(togv); /* Now listen on fromgv, etc. */ Hope this makes sense. Stuart Levy, Geometry Center
|
||
Home | Overview | FAQ | Documentation | Support | Download | Mailing List Windows? | Development | Bug Reporting | Contributing | Contact Us | Sponsors |
|||
site hosted by |