Solved

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

Posted on 2008-10-23
3
847 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
3 Comments
 
LVL 6

Accepted Solution

by:
Werrock earned 500 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

747 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now