Prepare for your Next Interview
This is a discussion on Difference in these UNIX commands within the Unix/Linux forums, part of the Operating Systems category; Can someone tell me the difference between these commands namely? ctermid(), ttyname(), cuserid(), getlogin()...
|
|||
|
Re: Difference in these UNIX commands
ttyname() - This returns name of a terminal.
cuserid() - This get character login name of the user getlogin() - This returns a pointer to a string containing the user name associated by the login activity with the controlling terminal of the current process |
| The Following User Says Thank You to timmy For This Useful Post: | ||
|
|||
|
Re: Difference in these UNIX commands
Interesting to learn!!!! The associated header files for each are given below:
ctermid() - stdio.h ttyname() - unistd.h cuserid() - stdio.h getlogin() - unistd.h |
|
|||
|
Re: Difference in these UNIX commands
The syntax for cuserid() is
#include char *cuserid(char *t); The function cuserid() gives the user id associated with the process. The interesting part is in the return values of this function cuserid() namely If t is not a null pointer but if the associated login id or name could not be found then *t is placed with '\0' which denotes a null byte. If t is a null pointer and if the associated login id or name could not be found then return value from this function is a null pointer If t is a null pointer and if the associated login id or name can be found then return value from this function is the address of the storage area which has the corresponding login id or the username of the process. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| difference between QTP and WinRunner | georgeprakash | WinRunner | 18 | 3 Weeks Ago 01:43 AM |
| Linux and UNIX - Which is better | blenda | Unix/Linux | 4 | 06-25-2008 07:53 AM |
| Difference between Usability and Functional Testing | sunny_love | Testing Issues | 12 | 10-08-2007 02:08 AM |
| Signal Handling in UNIX | blenda | Unix/Linux | 2 | 02-08-2007 02:17 AM |
| Semaphore in UNIX | blenda | Unix/Linux | 2 | 06-22-2006 02:26 PM |