Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-03-2009
Member
 
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
Reply With Quote
  #2  
Old 06-03-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
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.
Reply With Quote
  #3  
Old 06-03-2009
Member
 
Join Date: May 2008
Posts: 2,383
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.
Reply With Quote
  #4  
Old 06-03-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
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
Reply With Quote
  #5  
Old 06-03-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Help Regarding Header Files"
Thread Thread Starter Forum Replies Last Post
Connect USB 3.0 front case panel header to motherboard w/o a header? Dogs-Day-Out Motherboard Processor & RAM 4 14-04-2012 07:02 PM
Header files of Java Ram Bharose Software Development 5 30-12-2009 11:44 AM
Why we use Header Files Jaiwanti Software Development 3 19-11-2009 08:25 AM
IIS7: Add expires header or cache-control header quota Software Development 3 06-06-2009 07:45 PM
Compiler Error in Visual Studio 6,while adding OpenGL as header files. Santanio Software Development 2 12-01-2009 08:40 PM


All times are GMT +5.5. The time now is 04:10 AM.