I have some class in .h file, for example:
class Test {
public:
static const char* superData;
private:
static const char* getSuperData();
};
then I want to init superData
in .cpp file in such a way:
const char* Test::superData = getSuperData();
But when I get superData there is only some garbage.
const char* Config::getSuperData()
{
char username[UNLEN + 1];
DWORD username_len = UNLEN + 1;
GetUserName(username, &username_len);
return username;
}
If I call getSuperData() it gives me username, not garbage. Test::superData
I call in my main()
function.