Search code examples
c++windowspathdirectory

Getting user temporary folder path in Windows


How I can get the user's temp folder path in C++? My program has to run on Windows Vista and XP and they have different temp paths. How I can get it without losing compatibility?


Solution

  • Is there a reason you can't use the Win32 GetTempPath API?

    This API is available starting with W2K and hence will be available on all of your listed targets.