Thread: is a header file the answer?

  1. #1
    Registered User
    Join Date
    Oct 2001

    is a header file the answer?

    I am writing a prog. which performs tools on a variety of other C progs. When I know that paths of these files, I can store them as an array in my source code.
    However, I want to be able to allow a third party to add progs, change paths etc without messing with my source code, Is the best way to do this by putting the array in a header file? Would the third party then have to compile this header file after every modification? (I am assumiong that they won't have a C compiler). Or would it be better to store them in a .txt file (which won't need compiling. In this case though, I would be opening a file that gives me another file to open, if you see what I mean. This may be too complicated)? Or is there another way?

    Thanks for any help,


  2. #2
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    most programs have ini or configuration files, where user preferences, options, window position etc. get stored. Using the system registry (if you're developing win apps) is another option, but it's not always the best idea to mess with the registry.

    So, why not use a simple text file for storing such data in the programs directory? ( I used once a binary file which was one byte long - big enough for storing 8 flags each representing some user settings).

    Of course, you have to implement the required error handling - e.g. checking upon startup whether the file exists, protect it through some algorythm (checksum generation) if needed, etc.

    Have fun!

    The idea with *.h files - you'd have to provide your source, eventually libs, dll's, and a compiler, of course - is totally bad in my opinion, at least never heard of such unprofessional solution before ;)=)
    Last edited by Carlos; 12-10-2001 at 08:22 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. Need help understanding Header Files
    By Kaidao in forum C++ Programming
    Replies: 11
    Last Post: 03-25-2008, 10:02 AM
  3. Class methods in header or source file?
    By TriKri in forum C++ Programming
    Replies: 13
    Last Post: 09-17-2007, 05:23 AM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  5. Replies: 6
    Last Post: 04-02-2002, 05:46 AM