I'm writing a function in C++ which creates a temporary directory. Such function should be as most portable as possible, e.g. it should work under linux, mac and win32 environments. How do I achieve that?
This doesn't exist on Windows, as far as I know. :(
dauphic
2010-08-01 03:00:02
I guess you are writer ... deleting ...
2010-08-01 03:17:08
there is no platform independent way to do it in standard c/c++, use GetTempPath and GetTempFileName on Windows
Kane
2010-10-21 09:33:36
A:
There's no standard function to do this, so you'll need to compile different implementations for each platform you target.
On Windows, for example, you should use the temp directory, which can be obtained by a call to GetTempPath().
dauphic
2010-08-01 02:59:47
+1
A:
Boost's Filesystem library provides platform-independent directory functions. It will increase your program size a bit, but using Boost is often better (and often easier) than rolling your own.
http://www.boost.org/doc/libs/1_43_0/libs/filesystem/doc/index.htm
peachykeen
2010-08-01 03:08:31