I am working on a C++ application that can be run on both Windows and Unix based environments. This answer shows how to get hostname using Boost. I was wondering if there is a Boost function to also get the login name of the current user. For example, if I have username@hostname
in Linux, then I want to retrieve username
. I know there are techniques to do this without using Boost but I would like to know if I can do this with Boost. I have looked at some documentation related to the Boost library but I couldn't find anything useful.
Asked
Active
Viewed 721 times
0

an4s
- 161
- 1
- 10
-
Can't find anything either, except maybe using Boost.Process to launch `whoami` and grab its output... – hlt May 11 '18 at 20:12
-
What you're almost certainly looking for is an OS-independent API call that will call the OS-dependent system call in its code. If Boost has an OS-centric library, then it will probably offer some kind of functionality like that. Otherwise, it's probably not something Boost offers. – Xirema May 11 '18 at 20:12