Tutorial For Header Files?

This is a discussion on Tutorial For Header Files? within the C++ Programming forums, part of the General Programming Boards category; Is there a tutorial for header files in cprogramming.com? or any other sites? i need full information on what they ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    25

    Tutorial For The HEADER???

    Is there a tutorial for header files in cprogramming.com? or any other sites? i need full information on what they are used for, how to use them, and how they work etc.

    im confused on them right now.... so can i get fullll info about header files and others that are related to it?
    Last edited by yakabod; 08-22-2003 at 05:44 PM.

  2. #2
    Spaced Cadet
    Join Date
    Aug 2003
    Posts
    110
    you can make header files for your purposes, I'd use them but its simpler just to use one file, but to have a multi-programmer program use header files to load all the different functions that are used for the program. There are some default header files that came with your compiler, they open just like a txt or cpp file would.

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    25
    i dont get it..

    so u use it to do what?

    include a file that u made already??

    like if i made a file called "blahblah" and it will be in that program im making. i should add the include code to the other files????


    pretty confusing..

    can someone put it in noob terms
    im still a noob...

    ....but im trying my best to help people out

    ...doing that will help me understand more and more about c++


  4. #4
    Registered User harryP's Avatar
    Join Date
    Sep 2002
    Posts
    124
    Basically, if you are going to re-use the same code a lot in different programs, it's best to put it into a header file. Then when you include the file into the program (#include "blahblah.h"), you won't need to re-type all the code. It's sort of a convenience thing. For example:
    Code:
    // This "file" is function.h
    // I don't know if you know about functions yet or not, but for the sake of the example...
    #include <iostream.h> // To display the message
    
    void Say(char * message)
    {
         cout << message;
    }
    // End of function.h
    
    ...
    
    // This "file" is blah.cpp
    #include "function.h"
    
    int main()
    {
         Say("Hello World!\n");
         return 0;
    }
    // End of blah.cpp
    I dunno if that helped at all, but here's hoping

    Brendan
    Draco dormiens nunquam titallandus.
    Console Graphics Library: http://www.geocities.com/steve_alberto/cgl.html

  5. #5
    Registered User
    Join Date
    Jan 2003
    Posts
    25
    yea i understand functions already and also i understand that alreayd..

    koo now i know what the headers are used for.... kool
    im still a noob...

    ....but im trying my best to help people out

    ...doing that will help me understand more and more about c++


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Create Copies of Files
    By Kanshu in forum C++ Programming
    Replies: 13
    Last Post: 05-09-2009, 07:53 AM
  2. Reading .dat files from a folder in current directory...
    By porsche911nfs in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2009, 09:52 PM
  3. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 01:41 PM
  4. Folding@Home Cboard team?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 398
    Last Post: 10-11-2005, 08:44 AM
  5. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21