tanmh
asked on
How to get user log-in name? - for jhance
hi,
in relation to the previous qn i asked,
can u pls guide me on how to return the user name in a char buffer? I need to pass this data to other functions and
I am facing difficulties converting it to char buffer.
char* GetLogin()
{
NET_API_STATUS netStatus;
WKSTA_USER_INFO_0 *buf;
netStatus = NetWkstaUserGetInfo(NULL, 0, (LPBYTE *)&buf);
//wprintf(_T("Username is %s\n"), buf->wkui0_username);
//NetApiBufferFree(buf);
return buf->wkui0_username;
}
int main(int argc, TCHAR* argv[])
{
char* buf = GetLogin();
cout<<buf<<endl;
return 0;
}
Thanks.
Andrea
in relation to the previous qn i asked,
can u pls guide me on how to return the user name in a char buffer? I need to pass this data to other functions and
I am facing difficulties converting it to char buffer.
char* GetLogin()
{
NET_API_STATUS netStatus;
WKSTA_USER_INFO_0 *buf;
netStatus = NetWkstaUserGetInfo(NULL, 0, (LPBYTE *)&buf);
//wprintf(_T("Username is %s\n"), buf->wkui0_username);
//NetApiBufferFree(buf);
return buf->wkui0_username;
}
int main(int argc, TCHAR* argv[])
{
char* buf = GetLogin();
cout<<buf<<endl;
return 0;
}
Thanks.
Andrea
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OOps, sorry. Didn't notice the "for jhance" part. You can reject it if you want jhance to get the points (although the answer is correct...)
ASKER
hi alexo,
although it was for jhance but he didn't take up this question
and your answer is correct so it is only right that
I give you the marks.
Thanks.
Andrea
although it was for jhance but he didn't take up this question
and your answer is correct so it is only right that
I give you the marks.
Thanks.
Andrea
Actually I see no reason in restricting questions to a single expert (unless, of course, if those are "dummy" questions to award points).