Gets the alphanumeric user name associated with the current process.
Use the libc_r.a library to access the thread-safe version of this subroutine.
#include <stdio.h>
char *cuserid ( Name)
char *Name;
The cuserid subroutine gets the alphanumeric user name associated with the current process. This subroutine generates a character string representing the name of a process's owner.
Note: The cuserid subroutine duplicates functionality available with the getpwuid and getuid subroutines. Present applications should use the getpwuid and getuid subroutines.
If the Name parameter is a null pointer, then a character string of size L_cuserid is dynamically allocated with malloc, and the character string representing the name of the process owner is stored in this area. The cuserid subroutine then returns the address of this area. Multithreaded application programs should use this functionality to obtain thread specific data, and then continue to use this pointer in subsequent calls to the curserid subroutine. In any case, the application program must deallocate any dynamically allocated space with the free subroutine when the data is no longer needed.
If the Name parameter is not a null pointer, the character string is stored into the array pointed to by the Name parameter. This array must contain at least the number of characters specified by the constant L_cuserid. This constant is defined in the stdio.h file.
If the user name cannot be found, the cuserid subroutine returns a null pointer; if the Name parameter is not a null pointer, a null character ('\0') is stored in Name [0].
Name | Points to a character string representing a user name. |
This subroutine is part of Base Operating System (BOS) Runtime.
The endpwent (getpwent, getpwuid, getpwnam, putpwent, setpwent, or endpwent Subroutine) subroutine, getlogin (getlogin Subroutine), getpwent (getpwent, getpwuid, getpwnam, putpwent, setpwent, or endpwent Subroutine), getpwnam (getpwent, getpwuid, getpwnam, putpwent, setpwent, or endpwent Subroutine), getpwuid (getpwent, getpwuid, getpwnam, putpwent, setpwent, or endpwent Subroutine), or putpwent (getpwent, getpwuid, getpwnam, putpwent, setpwent, or endpwent Subroutine) subroutine.
Input and Output Handling Programmer's Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.