How to find the header file of variables and constants in linux

Source: Internet
Author: User
How to find the header file of variables and constants in linux-general Linux technology-Linux programming and kernel information. For more information, see the following. Today, I read programs written by others. When I encountered a function, the constant could not find the header file. I had a good solution in windows. I saw it in linux, so I picked it for future reference.

From: Beginning. Linux. Programming, Third. Edition

It's often convenient to use the grep command to search header files for particle definitions and function
Prototypes. Suppose we need to know the name of the # defines used for returning the exit status
From a program. Simply change to the/usr/include directory and grep for a probable part of
Name like this:
$ Grep EXIT _ *. h
...
Stdlib. h: # define EXIT_FAILURE 1/* Failing exit status .*/
Stdlib. h: # define EXIT_SUCCESS 0/* Successful exit status .*/
...
$
Here grep searches all the files in the directory with a name ending in. h for the string EXIT _. In this
Example, it has found (among others) the definition we need in the file stdlib. h.

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.