UNIX & GNU/Linux - System calls - Using getenv()

The getenv() function is a Linux system call function.

It is designed to know what is the name of an environment variable.

The main use is for the "TERM" variable. Let's see an example of the getenv() function:

/*                                                                           
** Made by BadproG.com                                                       
*/

#include        <stdio.h>

int     main()
{
  const char *name;

  name = "TERM";
  printf("My terminal is %s.\n", getenv(name));
  return (0);
}

 

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.