[Openmcl-devel] Pre-wheel-reinvention query: anyone written an FFI hookup to popen?
gb at clozure.com
Thu Jun 4 19:29:48 EDT 2009
(defun popen (command mode)
"command should be a string, passed to \"sh -c\". mode indicates
whether the returned stdio stream will be open for reading (\"r\"),
writing (\"w\"), or both (\"r+\").
Return value is a pointer to an stdio stream; if the pointer's NULL,
an error occurred."
(with-cstrs ((ccommand command)
(let* ((stdio-stream (#_popen ccommand cmode)))
(if (%null-ptr-p stdio-stream)
The number of things that you can usefully do with a C "FILE *" pointer
in CCL is pretty limited. You could pass that pointer to foreign code
that wants a "FILE *", or if you were really trying to avoid use of
CCL:RUN-PROGRAM for some reason you could write a Gray Stream wrapper
around stdio streams, but it seems like it'd be simpler to just use
On Thu, 4 Jun 2009, Ron Garret wrote:
> Subject line says it all. I need to call popen. I'm sure it's not
> hard, which is why I thought I'd ask if it's already been done before
> diving in.
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel