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.
Refresh Type the characters you see in this picture. Type the characters you see in the picture; if you can't read them, submit the form and a new image will be generated. Not case sensitive.  Switch to audio verification.