| |||||||||||
File uid to Username in C++ using lstat Posted by hjortur (hjortur), 19 November 2007 Hi. I am writin a program in C++ that takes file information from files using lstat...but when I come to the part of writing out the username I only get uid using lstat. Is there an easy way to extract this info from the system ...perhaps using the passwd file along with uid?Posted by george_Ball (george), 20 November 2007 You have to use a lib function called getpwuid, which returns you a pointer to a structure that contains all the info form the password file, amongst which is the user's name.That's what tools like ls do - remember once you have logged in to a Unix system you cease to have a name, only a number (your uid)... This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |