#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    16
    Rep Power
    0

    Linux C++ : how to write ini file


    hi all,
    how can i access/write to ini file?In Visual C++ we can use WritePrivateProfileString function.. but in linux how i can do this..
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,625
    Rep Power
    4247
    For accessing, see answers by mitakeet and Clifford:
    http://forums.devshed.com/t78852/s.html
    Last edited by Scorpions4ever; September 25th, 2003 at 12:55 AM.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    244
    You write to an ini file just like you would write to any other file. Just because MS sees fit to produce some dumb library function doesn't mean that you have to use it. Throw off the shackles of Bill and learn to use real programming tools.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw
  6. #4
  7. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,156
    Rep Power
    2222
    Linux programs don't use .ini files, but rather .conf files (configuration files). There's nothing magical about them. They're just flat text files. Check out some of the .conf files under /etc for ideas about how they're formatted. Usually, a comment begins with the '#' character.

    Read the thread that Scorpions pointed you to, since it contains some code for parsing a line from a .conf file.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    16
    Rep Power
    0
    so that mean i can write/access that file like a normal file such as fopen,fget etc.. thanks everyone..

IMN logo majestic logo threadwatch logo seochat tools logo