We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
开发者_StackOverflow Improve this questionI want to get current login user name in windows xp, windows 7, in c++. How can I do this? Is there any handy API without authority problem?
Use the Win32 API GetUserName or GetUserNameEx if you want a little more options.
This should work:
char sz[256];
GetEnvironmentVariable ("USERNAME", sz, 256);
精彩评论