creating a temporary fifo (tmpfile but for fifo)

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 13 19:15:53 PST 2017


On 2/13/17 12:12 PM, Paul Backus wrote:
> On Sunday, 12 February 2017 at 11:47:26 UTC, Timothee Cour wrote:
>> * std.stdio.tempfile creates an (unnamed) File. How do I create a
>> temporary
>> fifo instead?
>> my workaround is to use tempnam but docs says it's not recommended (
>> http://man7.org/linux/man-pages/man3/tempnam.3.html)
>
> I believe the recommended function for this is mkstemp. [1]
>
>> * could we allow specifying a directory name for tmpfile?
>
> Yes, using mkdtemp. [2]
>
> Note that these functions are part of POSIX but not C99, and are not
> included in D's core.stdc module.
>
> [1] http://man7.org/linux/man-pages/man3/mkstemp.3.html
> [2] http://man7.org/linux/man-pages/man3/mkdtemp.3.html

They're declared in core.sys,posix.stdlib. -- Andrei


More information about the Digitalmars-d mailing list