cfg files in C

cpp Grenada
  • 14 years ago
    hi,
    can anybody give me some details about cfg files.
    that means structure of cfg files,creating a cfg file and reading a cfg file in c.
    thank u


  • 14 years ago

    Hi harish

    You can handle cfg files in notepad

    Regards
    DoctorMahdi

  • 14 years ago

    here's an example of a cfg (config) file for a word processor

    [Fonts]
    Default=Arial
    Current=Arial
    Size=14
    [UI]
    Toolbar=true
    Title=Word Processor





    and so on... text within the square brackets ([ ]) is a sub-heading, while the text below it is an option (ie. option_name=option value)

    it should be easy to write a simple parser for a config file in C

  • 14 years ago

    here's an example of a cfg (config) file for a word processor

    [Fonts]
    Default=Arial
    Current=Arial
    Size=14
    [UI]
    Toolbar=true
    Title=Word Processor





    and so on... text within the square brackets ([ ]) is a sub-heading, while the text below it is an option (ie. option_name=option value)

    it should be easy to write a simple parser for a config file in C

  • 14 years ago

    here's an example of a cfg (config) file for a word processor

    [Fonts]
    Default=Arial
    Current=Arial
    Size=14
    [UI]
    Toolbar=true
    Title=Word Processor





    and so on... text within the square brackets ([ ]) is a sub-heading, while the text below it is an option (ie. option_name=option value)

    it should be easy to write a simple parser for a config file in C

  • 14 years ago

    config files can contain anything you want them to contain, and in any format you desire.  The formats previously posted are standard *.ini file formats, often used by MS-Windows such as win32 api function GetPrivateProfileString(). 

  • 14 years ago

    srry about the triple-post - didn't realise that happened... must confirm what i want to say before i click post...

    i'd suggest also looking into using the windows registry, it's always gonna be there and you don't have to worry that some one moved the config file (or you could just have a set of defaults if the file doesn't exist)

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The question of whether computers can think is just like the question of whether submarines can swim.” - Edsger W. Dijkstra