On Wed, 14 Jan 2009, Reenen Laurie wrote:

> Ok, so if I want code in which I want to get the username, which is
> crossplatform... how should it look?
> 
> {$ifdef windows}
>   username := GetEnvironmentVariable('USERNAME');
> {$endif}

I'm not sure if this is correct; There is a windows call to get the
current user name.

> {$ifdef linux}
>   GetUserData(FpGetuid, Data);
>   username := Data.pw_uid;
> {$endif}
> 
> How about MacOS?

For MacOS the linux construct should work ?

> 
> Also, as a matter of interest... what types are FpGetuid and Data?

Integer (or word) and pw_nam, I think ?

Michael.
_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to