Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



C : Use of ctermid()

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 30-01-2010
Member
 
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.

Reply With Quote
  #2  
Old 30-01-2010
Member
 
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.
Reply With Quote
  #3  
Old 30-01-2010
Member
 
Join Date: May 2008
Posts: 2,008
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.
Reply With Quote
  #4  
Old 30-01-2010
Member
 
Join Date: Apr 2008
Posts: 2,001
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 );
}
Reply With Quote
  #5  
Old 30-01-2010
Member
 
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);
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search



All times are GMT +5.5. The time now is 08:29 AM.