Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Jun 2002 11:34:33 +0200
From:      Sheldon Hearn <sheldonh@starjuice.net>
To:        Mark Murray <mark@grondar.za>
Cc:        Jonathan Belson <jon@witchspace.com>, current@freebsd.org
Subject:   Re: Perl scripts that need rewiting - Any volunteers?
Message-ID:  <20020625093433.GF73283@starjuice.net>
In-Reply-To: <200206250920.g5P9KJnG005006@grimreaper.grondar.org>
References:  <3D17770E.1060904@witchspace.com> <200206250920.g5P9KJnG005006@grimreaper.grondar.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On (2002/06/25 10:20), Mark Murray wrote:

> How's this?
> 
> int handle;
> template = "/tmp/mumbleXXXXXXXX";
> char *cmd;
> handle = mkstemp(template); // template is modified
> asprintf(cmd, "prog > %s", template);
> system(cmd);
> close(handle); // bye-bye file

It would be failsafe if you tested that mkstemp() had not returned an
error.

Ciao,
Sheldon.

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?20020625093433.GF73283>