C query

Discussion in 'C' started by kpnayak86, Aug 7, 2008.

Thread Status:
Not open for further replies.
  1. kpnayak86

    kpnayak86 New Member

    Joined:
    Jul 29, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I have one simple query in C:

    I have a file which has many name-value parameters like
    vinay=20
    prashanth=30
    path=(some path name)
    Also there are some name-value parameters which are commented like
    #section=some section

    the problem is i want to check for these values which are NOT commented and display those which are missing in the file and leave the commented ones(hashed ones) just like that. these name-value parameters should be there in a file and hence are fixed in that file...

    Wat i thought was to store the only name say prashanth in a char array and read the file line by line (using fgets) and get the name part from the file by delimiting it to '=' and compare it with the char array . If it returns 0 the update a int array which stores some values say 0 before , update it to 1 if the compare is 0.

    Can u suggest any other way or correct me where i am wrong .

    if code is given i would be greatful

    Pls mail to my email id
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,346
    Likes Received:
    382
    Trophy Points:
    83
    Duplicate of C query. Thread closed.
     
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice