Solved

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

Posted on 2008-10-23
3
856 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

776 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