Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Jun 2002 01:54:00 +0200
From:      Cyrille Lefevre <cyrille.lefevre@laposte.net>
To:        Jonathan Belson <jon@witchspace.com>
Cc:        Mark Murray <mark@grondar.za>, current@freebsd.org
Subject:   Re: Perl scripts that need rewiting - Any volunteers?
Message-ID:  <20020624235400.GB1550@gits.dyndns.org>
In-Reply-To: <3D17770E.1060904@witchspace.com>
References:  <3D0A464B.7040904@witchspace.com> <200206222154.g5MLsva4041792@grimreaper.grondar.org> <3D17770E.1060904@witchspace.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 24, 2002 at 08:46:22PM +0100, Jonathan Belson wrote:
> Mark Murray wrote:
> >o Please do not use mktemp(); use mkstemp() instead.
> 
> I used mktemp() to get a filename to redirect to, eg.
> 
> /* Improvised example */
> char *cmd;
> asprintf(cmd, "prog > %s", mktemp(blah));
> system(cmd);
> free(cmd);
> 
> I couldn't see a simple way around this, any clues?
int fd = mkstemp (blah);
asprintf(cmd, "prog > /dev/fd/%d", fd);

I don't look at the code, but how about popen(3) ?

Cyrille.
-- 
Cyrille Lefevre                 mailto:cyrille.lefevre@laposte.net

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020624235400.GB1550>