Using system calls under Linux to get the current username (revision)

xiaoxiao2021-03-06  62

I saw the message given by the netizen. It was originally not so troublesome. I would like to make friends YXX2008.

#include #include #include #include

INT main () {uid_t userid; struct passwd * pwd; userid = getuid (); Printf ("Userid IS% D / N", UserID); PWD = getPwUID (userID); Printf ("UserName IS% S / NUSERDIR i % S / N ", PWD-> PW_NAME, PWD-> PW_DIR);

转载请注明原文地址:https://www.9cbs.com/read-114037.html

New Post(0)