[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: system call: how to get access to results ?
From: |
Dale P. Smith |
Subject: |
Re: system call: how to get access to results ? |
Date: |
Sat, 16 Sep 2000 13:04:50 -0400 |
"Dale P. Smith" wrote:
> David Pirotte wrote:
> > The system "displays" the result, but returned value is the exit code
> >
> > How can I "get access" to the expected returned value ?
>
> How about the popen module? Something like (pardon my lame code):
I happier with this:
(use-modules (ice-9 popen))
(define (system-with-output-to-string command)
(let* ((p (open-input-pipe command))
(output (read-delimited "" p)))
(if (eof-object? output)
""
output)))
(define (system-date . rest)
(system-with-output-to-string
(format #f "date ~A" (if (null? rest)
"'+%d-%m-%Y'"
(car rest)))))
(display (system-date))
(display (system-date ""))
--
Dale P. Smith
Altus Technologies Corp.
address@hidden
400-746-9000 x309