|
| ||||||||||
| Tags: c language, ctermid, function, header, string |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| C : Use of ctermid()
|
|
#2
| ||||
| ||||
| C : Use of ctermid()
Hi, According to me ctermid() function can be the function that is exist in the built-in header files. For the calling process, The String that can consist of the path name of the current controlling terminal is generated by the ctermid() function. The string can be built in a static buffer and a pointer to the buffer can be returned, if the character argument can be NULL. The path name can be placed in the string, if character argument can not be NULL. This string can be long at least L_ctermid characters. |
|
#3
| |||
| |||
| Use of ctermid()
Hello, The ctermid() function can generates the pathname of the current controlling terminal. The following is the general syntax of the ctermid() function : #include <stdio.h> char *ctermid( char *S ); If the function that was unable to locate the terminal controlling, a pointer to a null string or a pointer to the pathname of the controlling terminal. |
|
#4
| ||||
| ||||
| Re: C : Use of ctermid()
I guess you should understands from the following code of lines that helps you to know about the ctermid() function : #include <stdio.h> int main( void ) { printf( " Controlling the terminal is = %s\n ", ctermid( NULL ) ); return( EXIT_SUCES ); } |
|
#5
| ||||
| ||||
| C : Use of ctermid()
The function ctermid() fills a buffer with the path name of the controlling terminal. An internal static array can be used, If buffer is NULL. The buffer must be at least L_ctermid characters long.The ctermid() function has one argument : buffer that points to a block of memory for storing the terminal path name or is NULL. The following is the example of the ctermid() function : #include <stdio.h> #include <paths.h> #include <string.h> char * ctermid(S) char *S; { static char df[] = _PH_Y; if (S) { bcopy(df, S, sizeof(_PH_Y)); return(S); } return(df); } |