Click here to Skip to main content
15,894,740 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Please provide me a sample program in vc++.net to write and read from ini file.
Posted

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.
 
Share this answer
 
Comments
Espen Harlinn 15-Mar-11 15:32pm    
Good links - working directly with the windows API is also an option, my 5
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.
 
Share this answer
 
v2
Comments
Dalek Dave 15-Mar-11 12:39pm    
Good Answer.
Nuri Ismail 15-Mar-11 15:13pm    
Thank you! :)
Member 7756096 16-Mar-11 5:56am    
Thanks for providing the details.
Espen Harlinn 15-Mar-11 15:31pm    
Good - I agree with Dalek, my 5
Nuri Ismail 16-Mar-11 4:07am    
Thank you very much! :)
See GetPrivateProfileString & WritePrivateProfileString in MSDN. ;)
 
Share this answer
 
Comments
Dalek Dave 15-Mar-11 12:38pm    
Good Call!

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900