Results 1 to 5 of 5

Thread: Help Regarding Header Files

  1. #1
    Join Date
    Jan 2009
    Posts
    65

    Help Regarding Header Files

    hi there

    I have been learning the GNU C Tutorial for C language and I came on the section of header files, it doesnt explain it in simpler terms so I am a bit confused.

    Can any one help me in understanding Header files concept

    Please provide some views regarding this

    Your views will be appreciated

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Help Regarding Header Files

    A header file is a file containing C declarations and macro definitions (see Macros) to be shared between several source files. You request the use of a header file in your program by including it, with the C preprocessing directive `#include'.

    Header files serve two purposes.
    System header files declare the interfaces to parts of the operating system. You include them in your program to supply the definitions and declarations you need to invoke system calls and libraries.
    Your own header files contain declarations for interfaces between the source files of your program. Each time you have a group of related declarations and macro definitions all or most of which are needed in several different source files, it is a good idea to create a header file for them.

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    Re: Help Regarding Header Files

    Header files serve two purposes.
    System header files declare the interfaces to parts of the operating system. You include them in your program to supply the definitions and declarations you need to invoke system calls and libraries.
    Your own header files contain declarations for interfaces between the source files of your program. Each time you have a group of related declarations and macro definitions all or most of which are needed in several different source files, it is a good idea to create a header file for them.

    Including a header file produces the same results as copying the header file into each source file that needs it. Such copying would be time-consuming and error-prone. With a header file, the related declarations appear in only one place. If they need to be changed, they can be changed in one place, and programs that include the header file will automatically use the new version when next recompiled. The header file eliminates the labor of finding and changing all the copies as well as the risk that a failure to find one copy will result in inconsistencies within a program.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Help Regarding Header Files

    In C, the usual convention is to give header files names that end with .h. It is most portable to use only letters, digits, dashes, and underscores in header file names, and at most one dot.
    Include Syntax
    Include Operation
    Search Path
    Once-Only Headers
    Alternatives to Wrapper #ifndef
    Computed Includes
    Wrapper Headers
    System Headers

  5. #5
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Help Regarding Header Files

    List of include files
    Common includes
    iostream.h Input/Output, interaction with the program. write, getline.
    fstream.h File input/output. open, close, getline
    iomanip.h For manipulating text with width, tabs, etc.
    stdlib.h Standard library for memory allocation, makes it possible to create integer variables, doubles, floats, etc.
    String.h C++ has no built-in string handling. Use this library to copy strings, find string length, etc.
    stdio.h Similar to stdlib but also has some file functions. printf, scanf.

Similar Threads

  1. Connect USB 3.0 front case panel header to motherboard w/o a header?
    By Dogs-Day-Out in forum Motherboard Processor & RAM
    Replies: 4
    Last Post: 14-04-2012, 07:02 PM
  2. Header files of Java
    By Ram Bharose in forum Software Development
    Replies: 5
    Last Post: 30-12-2009, 11:44 AM
  3. Why we use Header Files
    By Jaiwanti in forum Software Development
    Replies: 3
    Last Post: 19-11-2009, 08:25 AM
  4. IIS7: Add expires header or cache-control header
    By quota in forum Software Development
    Replies: 3
    Last Post: 06-06-2009, 07:45 PM
  5. Replies: 2
    Last Post: 12-01-2009, 08:40 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,750,387.11753 seconds with 16 queries