Shiny Language Reference

Language Reference > Basic Functions


getusername

string getusername();

 

 

Returns the Windows username of the current user

This statement returns the Windows username of the current user running Brass. This statement was intended for use where a plugin needs to store data on a per-user basis, and cannot use the Registry profile for the purpose. An example of this requirement would be a launcher-type plugin, where different users who use the same computer may want different options in the launcher panel.

You should sanity-check the returned username string if you intend to use it where extended characters may be illegal. For example, a username may contain illegal characters for a filename (especially where CD-ROM filesystems are concerned).

 

Parameters

None

 

Return Value

The current Windows username

 

Example Code

// Assuming Brass is running under Bob's desktop, CurrentUser will be
// set to "Bob"

string CurrentUser = getusername();