Modify

Opened 12 years ago

Closed 8 years ago

#590 closed Feature Requests (fixed)

mkstemp

Reported by: nobody Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: None Severity: Not Applicable
Keywords: Cc: bdawes@…

Description (last modified by Dave Abrahams)

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

Attachments (0)

Change History (6)

comment:1 Changed 10 years ago by Dave Abrahams

Cc: bdawes@… added
Component: Nonefilesystem
Description: modified (diff)
Severity: Showstopper

Can't reassign to Beman until he logs into Trac at http://svn.boost.org and sets his email address.

comment:2 Changed 10 years ago by Eric Niebler

Owner: changed from nobody to Beman Dawes
Status: assignednew

comment:3 Changed 9 years ago by Beman Dawes

Severity: ShowstopperNot Applicable

I'm considering #590 and #1090 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 #1090 is appealing, but more work needs to be done. Suggestions welcome.

--Beman

comment:4 Changed 9 years ago by Beman Dawes

Milestone: To Be Determined
Status: newassigned

No progress yet. Needs a design that abstracts away differences between POSIX and Windows. Contributions and/or suggestions welcome!

--Beman

comment:5 Changed 8 years ago by Andrey Semashev

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.

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:

void open_temp_file(fstream& strm);

The function would internally call tmpfile or whatever other API to create the file and attach it to the stream.

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.

comment:6 Changed 8 years ago by Beman Dawes

Resolution: Nonefixed
Status: assignedclosed

The unique_path() function in Version 3 addresses the problem. Version 3 will ship with 1.44.

Thanks,

--Beman

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Beman Dawes.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.