更新时间:2023-11-30 10:39:58
#include <stdio.h>
int main(void)
{
printf("%s\n", getenv("USERPROFILE")); // Print user's home directory.
return 0;
}
要获取用户名而不是主路径,请将 USERPROFILE
替换为 USERNAME
.
To get the user name instead of the home path replace USERPROFILE
with USERNAME
.