Urgent! CFG files
-
How can I create a cfg file and read from or write on it? Thanks for helping!
-
How can I create a cfg file and read from or write on it? Thanks for helping!
.cfg isn't a standard format, it's just a general "config file" type. For what app are you trying to write a .cfg file? --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber Pinky, are you pondering what I'm pondering? I think so Brain, but how will we fit the hamster inside the accordion?
-
How can I create a cfg file and read from or write on it? Thanks for helping!
Further to Michael's answer, it depends on whether you want to use Windows .INI style config files, or XML config files. For the former, take a look at the functions GetPrivateProfileString and WritePrivateProfileString, but note that using these APIs is not really encouraged, as they're intended for 16-bit compatability. For the latter, look at using MSXML or use whatever your choice in XML parsers happens to be. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
-
How can I create a cfg file and read from or write on it? Thanks for helping!
-
How can I create a cfg file and read from or write on it? Thanks for helping!
*.CFG is not a standard used by MFC. MFC usually uses *.INI. *.CFG is for .NET framework. Below is the code for C# to access the *.CFG(refering MSDN) Just change it to Managed C++
using System;
using System.Collections;
using System.Configuration;class MyConfigurationReader {
public void ReadMySettings() { IDictionary sampleTable = (IDictionary) ConfigurationSettings.GetConfig("sampleSection"); string value1 = (string)sampleTable\["setting1"\]; string value2 = (string)sampleTable\["setting2"\]; string value3 = (string)sampleTable\["setting3"\]; }
}
Sonork 100.41263:Anthony_Yio
-
Further to Michael's answer, it depends on whether you want to use Windows .INI style config files, or XML config files. For the former, take a look at the functions GetPrivateProfileString and WritePrivateProfileString, but note that using these APIs is not really encouraged, as they're intended for 16-bit compatability. For the latter, look at using MSXML or use whatever your choice in XML parsers happens to be. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
I'm going to use that in an MFC application to configure oracle connection. I want to use windows .INI style.
-
Further to Michael's answer, it depends on whether you want to use Windows .INI style config files, or XML config files. For the former, take a look at the functions GetPrivateProfileString and WritePrivateProfileString, but note that using these APIs is not really encouraged, as they're intended for 16-bit compatability. For the latter, look at using MSXML or use whatever your choice in XML parsers happens to be. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
Thanks for your reply :) I'm going to use that in an MFC application to configure oracle connection. I want to use windows .INI style.