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:[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to