Thread: .ini file Read/Write

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    6

    Question .ini file Read/Write

    Hi !
    I'm new to C-programmeing and need to read and write to an windows standard .ini file with sections aso.

    My question is if anyone have done it already and have some code for me to study and use ?

    Best regards

    Micael Waxby
    Sweden

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    You can also use the WinAPI to do the hard work for you. Lookup some of these functions (GetPrivateProfile* and WritePrivateProfile*)
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    6

    I'am on track !

    GetPrivateProfileString() worked great. Now I just have to figure out on how to convert strings to doubles/int :-)

    I guess I havenä't started with the easiest as a completly beginner with C.

    Thanks !

    Micael

  4. #4
    Registered User datainjector's Avatar
    Join Date
    Mar 2002
    Posts
    356
    your stdlib.h header file contains function to convert string to int/float/ouble etc.

    double atof( const char *nptr ); converts string to double
    int atoi ( cont char *nptr ); to int
    long atol ( ... to long

    check for some more fucntion concerning string to digit in stdlib.h ...
    "I wish i could wish my wishs away"

    "By indirections find directions out" -- William Shakespears

    "Do what thou wilt shall be the whole of the law" -- Crowley "THE BEAST 666"

    Mizra -> love = Death...
    RDB(Rocks yooo)..

    http://www.cbeginnersunited.com

    Are you ready for the Trix ???

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. file processing updating record error
    By uuser in forum C Programming
    Replies: 2
    Last Post: 04-27-2003, 12:13 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM