I want to get the process's user name and check if it is a local administrator . Or check directly if the current procees user is a local administrator
http://vcfaq.mvps.org/sdk/21.htm
How To Determine Whether a Thread Is Running in User Context of Local Administrator Account
These links might help [for Windows].
C++ has no notion of 'administrator'. Any solution would be via a platform specific library. What platform are you using?
Presuming you're on a Window OS there's a shell function: IsUserAnAdmin
See MSDN article
This article does suggest rolling your own function though, use CheckTokenMembership. There is even a code example to help you along.
Get the current username with GetUserName(), then call NetUserGetInfo() with the server name (NULL for local) and username you just got. Pass it a USER_INFO_1 structure, and then access usri1_priv in the structure. If the value is USER_PRIV_ADMIN, then you'll know that the username is an admin.