Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I create a temporary directory and later delete it?

Posted on 2008-10-23
3
Medium Priority
?
878 Views
Last Modified: 2012-06-22
I have a zip file which I need to unzip into a directory and work on those files.

I need assistance in creating a temporary directory under the current working directory which will be deleted after the operation and this should be portable on windows and linux.
0
Comment
Question by:Cool-Guy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
Werrock earned 1500 total points
ID: 22794037
Its a platform-dependent call so I would recommend you to check out the boost libraries at
http://www.boost.org/

More precisly, the filesystem library:
http://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/index.htm
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 22794252
standard C++ does not know how to create temporary directories. It can create temporary files though using tmpfile :

        http://www.cplusplus.com/reference/clibrary/cstdio/tmpfile.html

But that doesn't help you :)

There is a nice alternative : to use the system's temporary directory, which on POSIX compliant systems can be retrieved using the TMPDIR environment variable.
0
 

Author Closing Comment

by:Cool-Guy
ID: 31509540
Thanks for your time.
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question