Process Environment Detailed (iii)---environment table

Source: Internet
Author: User

The startup code, in addition to passing command-line arguments to main, also gets an environment table from the kernel. The environment table is pointed to by the global variable environ. The type of environ is defined as follows:extern char * * environ;/* This is defined in the Unistd.h header file */=====================================================but in the actual test, the use of the Environ pointer when the error, as shown inso go to the Unistd.h header file to see the original definition of Environ, as shown in As can be seen from the header file, to use the Environ variable, you need to implement the definition of __USE_GNU macro, and the default system is not defined in the macro, so in the source program instead of the __environ variable instead of environ Variable or at the beginning of the program declaration environ this variable can be resolved. ============================================================the method of viewing environment variables using the Environ variable can only view all environment variables at once because we do not know the location of the specific environment variable. If we want to know the value of a specific environment variable, we should use the GETENV function.

Process Environment Detailed (iii)---environment table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.