Re: How to determine user name from within C++ on linux



consultmac2 wrote:
Using c++ via gcc on Fedora Core 3:

For our project, we want to create a temp directory for the current
user if it does not already exist; something like /tmp/consultmac2.
Our program will write, read and ultimately delete files from that
directory, and eventually delete the directory as well.

How does one capture the logged-on user name from within c++ so we
can do that?

getenv, perhaps?

Or perhaps you would prefer to choose a directory name at random?
(look up /dev/urandom).

HTH,

Carlos
--
.