delorie.com/djgpp/doc/libc/libc_403.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

getlogin

Syntax

 
#include <unistd.h>

char *getlogin(void);

Description

Get the login ID of the user.

Return Value

Returns the value of the USERNAME environment variable if it is defined, else the LOGNAME environment variable, else the USER environment variable, else "dosuser".

USERNAME is set automatically by Windows NT and Windows 2000. None of these environment variables are set automatically on DOS, Windows 95 or Windows 98.

The stock version of the file `DJGPP.ENV' defines USER with the value "dosuser".

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001

Example

 
printf("I am %s\n", getlogin());


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004