[C++] Store logged username on PC in a variable

The title says all :smiley:

Check this: [url]Getting user name and saving it to scene variable? - #13 by Lizard-13]

It works for Windows only, and just modify the text for text objects passed as objectsList, to store the username in a variable you’ll have to call something like

scene.GetVariables().Get("username") = username;

For Linux, (from what I’m reading right now) you have to include “unistd.h” and get the string like:

getlogin_r(username, username_len);

with username_len = LOGIN_NAME_MAX+1, as the length of username array, I have NOT tested it, so maybe this one needs some fixes :wink:

Thank you :slight_smile: you have saved me 2 times :smiley: