Getting Username
BlitzMax Forums/BlitzMax Programming/Getting Username
| ||
I used to have some VBA code that i used in an access database. When someone opened the database it checked for the username (nt login name?) and i was able to use it as a field in my queries to allow/disallow different functions or screens. Does anyone have something similar for use in Blitzmax? Ideally a cross platform bit of code would be best, but i don't know anything about the other 2 platforms. Maybe there are separate ways to do this on Mac and Linux? If it isn't possible then i will go back to making the user logon to the application. Cheers Glenn |
| ||
If you were using wxMax, I might suggest wxGetUserId() and wxGetUserName(). Otherwise, you'll need to investigate the API's for each system. For example, on Linux/Mac you can use the commandline "who", but you can also use "who am i", which may return a different value depending on who you were originally logged in as - yes, you can change to different users on the fly :-) |
| ||
that's exactly what i am after. many thanks again |
| ||
just scanned the userguide and the help for wxwidgets. what section is this in? |
| ||
not to worry. it seems i don't need to import anything to get it working... |
| ||
It's part of core. MaxIDE *really* needs a searchable indexed help... |
| ||
No need to use a third party module...username:String=getenv_("USERNAME") does it for Windows and Linux. Replace "USERNAME" with "USER" for Mac. |
| ||
except USER is not set in stone.> echo $USER brucey > export USER=bob > echo $USER bob > whoami brucey |