Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 2nd, 2006, 03:02 AM
Registered User
Join Date: Jan 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading .ini files

Hi All,
Any idea about how to read the actual content of a .ini file from a C++ program. Can we create an .ini file from a C++ program? Please help.

Reply With Quote
  #2 (permalink)  
Old February 5th, 2006, 09:06 PM
Registered User
Join Date: Feb 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to chandarnat Send a message via Yahoo to chandarnat

In order to read a .INI file, you can use the GetPrivateProfileString API call. Refer to the following documentation.


You can use the WritePrivateProfileString to create or update an .INI file.

Hope this helps.

Reply With Quote
  #3 (permalink)  
Old February 7th, 2006, 05:02 PM
Registered User
Join Date: Feb 2006
Location: , , Philippines.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mikhailberis

If you intend on reading the .ini file (or any particular file format for that matter) and using it in your program, yes there's a way. The "best" way is to use your platform's particular API methods (as mentioned above).

Another way is to use an existing parser implementation that already parses the .INI file contents -- this might involve using third party code, or some previously exported library that comes with your platform's compiler/toolset.

Another way still is to roll your own parser and generator to be able to deal with .INI files the way you want to. You might even want to make your own configuration file format, or even just use XML instead for your configuration needs.

Dean Michael C. Berris
Orange and Bronze Technologies, Inc.
Mobile +639287291459
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
INI files Kis C# 3 April 2nd, 2015 05:04 AM
Reading an INI file in C# @shish C# 1 April 1st, 2015 04:00 AM
Reading ini file in XSL ROCXY XSLT 3 January 9th, 2007 04:37 AM
How to read and update .INI files using Pure C ?? Poonam C++ Programming 1 March 24th, 2005 01:22 AM
reading files nightsurfer JSP Basics 0 August 10th, 2003 04:34 PM

All times are GMT -4. The time now is 10:23 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.