Get USERID Using C++

What is the syntax to get the userid from a windows based system using c++ code?
eddiepardonAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
Either

char* pszUserID = getenv("USERNAME");

or

char acUserName[256];

GetUserName(acUserName,sizeof(acUserName));
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.