Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC8.0 VC9.0
Please provide me a sample program in vc++.net to write and read from ini file.
Posted 15-Mar-11 5:55am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

See GetPrivateProfileString & WritePrivateProfileString in MSDN. Wink | ;)
  Permalink  
Comments
Dalek Dave at 15-Mar-11 12:38pm
   
Good Call!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You already know about GetPrivateProfileString and WritePrivateProfileString from the answer of gtest_vs.
You can find examples on this functions in MSDN.
 
Also consider using a helper library or class instead of raw APIs. This can simplify things a lot.
For example you can use this INI Reader\Writer class[^] from CodeProject.
It comes in different versions for different platforms.
With a simple search you can find more classes and libraries like this.
  Permalink  
v2
Comments
Dalek Dave at 15-Mar-11 12:39pm
   
Good Answer.
Nuri Ismail at 15-Mar-11 15:13pm
   
Thank you! :)
Member 7756096 at 16-Mar-11 5:56am
   
Thanks for providing the details.
Espen Harlinn at 15-Mar-11 15:31pm
   
Good - I agree with Dalek, my 5
Nuri Ismail at 16-Mar-11 4:07am
   
Thank you very much! :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Read: GetPrivateProfileString
 
Check the following link for more details on the function:
 
http://msdn.microsoft.com/en-us/library/ms724353(v=vs.85).aspx[^]
 
Write: WritePrivateProfileString
 
Check the following link for more details on the function:
 
http://msdn.microsoft.com/en-us/library/ms725501(v=vs.85).aspx[^]
 

Check The following link for more information on the structure of an .INI File:
 
http://en.wikipedia.org/wiki/INI_file[^]
 

Regards
 
K,D.
  Permalink  
Comments
Espen Harlinn at 15-Mar-11 15:32pm
   
Good links - working directly with the windows API is also an option, my 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 150
2 PIEBALDconsult 110
3 Richard MacCutchan 105
4 Sergey Alexandrovich Kryukov 104
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 15 Mar 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100