How to create .h file in C

This is a discussion on How to create .h file in C within the C Programming forums, part of the General Programming Boards category; Hi all: I am a newbie, in a recent assignment, I was asked to generate a .h file in my ...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    26

    Smile How to create .h file in C

    Hi all:

    I am a newbie, in a recent assignment, I was asked to generate a .h file in my program. May I ask how to do this? I really do not know anything about file I/O.

    Thank you all

  2. #2
    Registered User Peritus's Avatar
    Join Date
    Aug 2008
    Posts
    3
    just create a file with an h extension, and don't forget to include it in the source file in which you want to use it.

    http://en.wikipedia.org/wiki/Header_file

  3. #3
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,479
    Just to clear somthing up, file IO is usually:

    Code:
    FILE*
    When you actually read in a file to the program - not creating a header file. Just so you know the difference that all.
    I'm just trying to be a better person - My Name Is Earl

  4. #4
    Registered User
    Join Date
    Sep 2008
    Posts
    26
    Hi guys:

    Thank you for your reply, but I think because I put my question the wrong way, it somewhat misled you.

    Here it goes again:


    In this assignment, I was asked to read from a text file and store whatever I read into an abstract data type (it may be a stack or queue or even mapping), and furthermore write the ADT to a .h file and save it.

    What I want to know is:

    Is there a function that creates a text file? Such as:

    void CreateTextFile(myHeaderFile);

    Thank you all

  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    fopen opens a file. fclose closes it. If you're writing text, fprintf prints stuff to a file.

  6. #6
    Registered User
    Join Date
    Sep 2008
    Posts
    26
    Cheers, will try it out.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  2. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  5. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM

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