On Tuesday 25 April 2006 02:40, Graeme Geldenhuys wrote:
> You can also read the environment variable  USER or USERNAME.
>
> This is what I have done:
>
> ------------------------------------------
> {$IFDEF MSWINDOWS}
> function tiGetUserName : string;
> var userNameBuffer : array[0..255] of char;
>     sizeBuffer : DWord;
> begin
>   SizeBuffer := 256;
>   getUserName(userNameBuffer, sizeBuffer);
>   result := string(userNameBuffer);
> end;
> {$ENDIF MSWINDOWS}
> {$IFDEF LINUX}
> function tiGetUserName : string;
> begin
>   Result := GetEnvironmentVariable('USERNAME');
>   if Result = '' then
>     Result := GetEnvironmentVariable('USER');
> end;
> {$ENDIF LINUX}
> ------------------------------------------
>
> Regards,
>   - Graeme -
>
> On 25/04/06, johnf <[EMAIL PROTECTED]> wrote:
> > Hi,
> > How do I find the username?  Getusername does not exist.  On Linux.
> >
> > John
>
> --
> There's no place like 127.0.0.1
This worked.  thanks 
John

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to