Results 1 to 5 of 5

Thread: C : Use of ctermid()

  1. #1
    Join Date
    Jan 2010
    Posts
    26

    C : Use of ctermid()

    Hello, Friends. I am finding difficulty in C programming language. I have the knowledge of the C language. But I don't know much more about the header files. I would like to know about the ctermid() function. I would also like to know about the what is the actual use of the ctermid() function and how can I able to use them in the C program. So, Can anyone has the answer to my query? If you know the solution for me then reply me as soon as possible.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    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. #3
    Join Date
    May 2008
    Posts
    2,012

    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. #4
    Join Date
    Apr 2008
    Posts
    2,005

    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. #5
    Join Date
    Nov 2005
    Posts
    1,323

    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);
    }

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,671,050.58243 seconds with 16 queries