Go to the first, previous, next, last section, table of contents.


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

not ANSI, POSIX

Example

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


Go to the first, previous, next, last section, table of contents.