Solved

Get USERID Using C++

Posted on 2006-11-08
1
278 Views
Last Modified: 2008-03-03
What is the syntax to get the userid from a windows based system using c++ code?
0
Comment
Question by:eddiepardon
1 Comment
 
LVL 86

Accepted Solution

by:
jkr earned 50 total points
ID: 17899053
Either

char* pszUserID = getenv("USERNAME");

or

char acUserName[256];

GetUserName(acUserName,sizeof(acUserName));
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question