I'm writing an application for windows, and I need to find the location of the appdata folder, to save, well, appdata to it. I'm using C++. When I did some research on this, I found some answers like, for example "getenv("APPDATA")"
. I could use that but that question was answered in like 2012 so there might be better ways to do it now in 2021. Thanks for the help!
#include <iostream>
int main() {
std::string appdataLocation;
//TODO: Find appdata folder location.
//enter code here
std::cout << appdataLocation << '\n';
}
Some people have been suggesting that this is a duplicate question. That question was asked 10 years ago. There may be better ways to do it right now, which is why I'm asking.