Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // title: login
- // ide: apple xcode
- // author: paulogp
- #include <stdio.h>
- #include <unistd.h>
- int main (int argc, const char * argv[])
- {
- // shall return a pointer to a string containing the user name associated
- // by the login activity with the controlling terminal of the current process.
- // if getlogin() returns a non-null pointer, then that pointer points to the
- // name that the user logged in under, even if there are several login names
- // with the same user ID.
- printf("username: %s\n", getlogin());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment