Boost C++ Libraries: Ticket #590: mkstemp https://svn.boost.org/trac10/ticket/590 <pre class="wiki">Could you add a function similar to mkstemp in boost::filesystem? It would be interesting if it could receive an boost::filesystem::path or an std::string as input and return a ofstream and a path or a string as output jesus.malo@bsc.es </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/590 Trac 1.4.3 Dave Abrahams Fri, 06 Jul 2007 12:06:31 GMT component, description changed; cc, severity set https://svn.boost.org/trac10/ticket/590#comment:1 https://svn.boost.org/trac10/ticket/590#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">bdawes@…</span> added </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">filesystem</span> </li> <li><strong>description</strong> modified (<a href="/trac10/ticket/590?action=diff&amp;version=1">diff</a>) </li> <li><strong>severity</strong> → <span class="trac-field-new">Showstopper</span> </li> </ul> <p> Can't reassign to Beman until he logs into Trac at <a class="ext-link" href="http://svn.boost.org"><span class="icon">​</span>http://svn.boost.org</a> and sets his email address. </p> Ticket Eric Niebler Wed, 11 Jul 2007 02:02:22 GMT owner, status changed https://svn.boost.org/trac10/ticket/590#comment:2 https://svn.boost.org/trac10/ticket/590#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">nobody</span> to <span class="trac-author">Beman Dawes</span> </li> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> </ul> Ticket Beman Dawes Sun, 29 Jun 2008 21:31:57 GMT severity changed https://svn.boost.org/trac10/ticket/590#comment:3 https://svn.boost.org/trac10/ticket/590#comment:3 <ul> <li><strong>severity</strong> <span class="trac-field-old">Showstopper</span> → <span class="trac-field-new">Not Applicable</span> </li> </ul> <p> I'm considering <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/590" title="#590: Feature Requests: mkstemp (closed: fixed)">#590</a> and <a class="new ticket" href="https://svn.boost.org/trac10/ticket/1090" title="#1090: Feature Requests: scoped_file class that deletes file at end of scope (new)">#1090</a> as indications of interest and need, but feel that there are various details to be worked out first. mkstemp and similar functions seem pretty dated. The C++ approach suggested by <a class="new ticket" href="https://svn.boost.org/trac10/ticket/1090" title="#1090: Feature Requests: scoped_file class that deletes file at end of scope (new)">#1090</a> is appealing, but more work needs to be done. Suggestions welcome. </p> <p> --Beman </p> Ticket Beman Dawes Sat, 30 May 2009 09:54:54 GMT status changed; milestone set https://svn.boost.org/trac10/ticket/590#comment:4 https://svn.boost.org/trac10/ticket/590#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> → <span class="trac-field-new">To Be Determined</span> </li> </ul> <p> No progress yet. Needs a design that abstracts away differences between POSIX and Windows. Contributions and/or suggestions welcome! </p> <p> --Beman </p> Ticket Andrey Semashev Fri, 03 Jul 2009 19:36:00 GMT <link>https://svn.boost.org/trac10/ticket/590#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/590#comment:5</guid> <description> <p> Not sure if this applies to this ticket, but I've been in need of temp files support many times, too. So here are my thoughts. </p> <p> Maybe, on the low level, such functionality could be reached through fstreams extension: if it was possible to construct fstream from FILE* then the tmpfile function could be used to create temporary files. On the higher level a wrapper function could be provided, such as: </p> <pre class="wiki">void open_temp_file(fstream&amp; strm); </pre><p> The function would internally call tmpfile or whatever other API to create the file and attach it to the stream. </p> <p> Scoped files, while they look appealing for some cases, are limiting when the lifetime of the stream has to span across scopes. A simple wrapper derived from the fstream and on top of open_temp_file can be provided, but it should not be the only way to do it. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Beman Dawes</dc:creator> <pubDate>Fri, 11 Jun 2010 15:48:42 GMT</pubDate> <title>status, resolution changed https://svn.boost.org/trac10/ticket/590#comment:6 https://svn.boost.org/trac10/ticket/590#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">fixed</span> </li> </ul> <p> The unique_path() function in Version 3 addresses the problem. Version 3 will ship with 1.44. </p> <p> Thanks, </p> <p> --Beman </p> Ticket