C Parser for parsing and reading Config file with defined format?

This is a discussion on C Parser for parsing and reading Config file with defined format? within the C Programming forums, part of the General Programming Boards category; Hi, I need to parse a configuration file , I need to compare the string variable and get the values. ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    4

    Post C Parser for parsing and reading Config file with defined format?

    Hi,
    I need to parse a configuration file , I need to compare the string variable and get the values.

    The variable and values are seperated by white spaces,
    For example,
    TestscenConf.config file contains the following,

    SCENARIO_TYPE WIRELESS_TEST
    SIMULATION_TIME 200
    [1] [IP_ADDR1][1] 192.168.1.0
    [2] [IP_ADDR2][1] 192.168.1.2
    [2] [IP_ADDR2][2] 192.168.1.3

    Here, everything is seperated by space.

    I want to compare variable name and get its value.

    How can I parse it in C or C++.

    Thank you,

    Arun

  2. #2
    Programming King Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Middle of NoWhere
    Posts
    320
    Your code please?

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Read in a line. Compare the first chunk of it with your list of things to look for. Do whatever is appropriate. Repeat until done.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help reading file streams
    By mjpam in forum C Programming
    Replies: 2
    Last Post: 05-13-2010, 11:42 PM
  2. reading from a file
    By bluetxxth in forum C Programming
    Replies: 8
    Last Post: 04-15-2010, 02:11 AM
  3. a problem with reading from a FILE
    By Makaila in forum C Programming
    Replies: 2
    Last Post: 01-13-2010, 04:15 AM
  4. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 04:30 PM

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