tags: c/c++ xml parsing ini c++
LPTSTR lpPath = new char[MAX_PATH];
strcpy(lpPath,"D:\\b.ini");
WritePrivateProfileString("LiMing","Sex","Man",lpPath);
WritePrivateProfileString("LiMing","Age","12",lpPath);
WritePrivateProfileString("ZhangSan","Sex","Women",lpPath);
WritePrivateProfileString("ZhangSan","Age","32",lpPath);
delete [] lpPath;
result

// TODO: Add control notification handler code here
CDialogEx::OnOK();
LPTSTR lpPath = new char[MAX_PATH];
LPTSTR LiMingSex = new char[6];
int LiMingAge;
LPTSTR ZhangSanSex = new char[6];
int ZhangSanAge;
strcpy(lpPath,"E:\\b.ini");
GetPrivateProfileString("LiMing","Sex","",LiMingSex,6,lpPath);
LiMingAge = GetPrivateProfileInt("LiMing","Age",0,lpPath);
GetPrivateProfileString("ZhangSan","Sex","",ZhangSanSex,6,lpPath);
ZhangSanAge = GetPrivateProfileInt("ZhangSan","Age",0,lpPath);
/*Read the integer value of the ini file
UINT GetPrivateProfileInt(
LPCTSTR lpAppName, // A field name [section name] in the INI file can have many section names
LPCTSTR lpKeyName, // A key name under lpAppName, which is the specific variable name inside
INT nDefault, // If the specified data is not found to return, the variable value is assigned to the return value
LPCTSTR lpFileName // Path of INI file
);
*/
/* Read ini file string
DWORD GetPrivateProfileString(
LPCTSTR lpAppName, // A field name [section name] in the INI file can have many section names (section name of the configuration file)
LPCTSTR lpKeyName, // A key name under lpAppName, which is the specific variable name (key name of the configuration file)
LPCTSTR lpDefault, // If lpReturnedString is empty, assign this variable to lpReturnedString
LPTSTR lpReturnedString, // The pointer variable that stores the key value is used to receive the receiving buffer of the key value (data) in the INI file
DWORD nSize, // buffer size of lpReturnedString
LPCTSTR lpFileName // Path of INI file
);
*/
background: We often need to manipulate configuration files in the process of doing projects.config .ini and other configuration files, Today let’s learn it first.ini configuration fileOperation...
C # read INI file instance Read the contents of the INI file, put the contents of the read in the specified location; write the content into the ini file As shown in the picture interface 1 C # read I...
Ini files were more prevalent before Win95. Later, due to the emergence of book publishing and other technologies, ini technology primary keys took a back seat. However, for some small projects, readi...
The INI file is a unique storage structure on Windows. This is just the storage structure invented under Windows. There are many similar ones, such as xml! Just talk about the TXT text. It is read by ...
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text;...
Configuration file often used in the ini file, its function in the VC were: .ini file write: Read .ini files: The return value is read integer value read :( whole) Relative and absolute paths can read...
1, the configuration file often used ini file, its function in the VC were: .ini file write: BOOL WritePrivateProfileString( LPCTSTR lpAppName, a field name // INI file [Section name] can be many sect...
Take Game.ini as an example For reading and writing of other configurations, see CoreGlobals.h here, just replace the GGameIni parameter below. These strings are saved in the path of the corresponding...
C++ Builder5 reads and writes INI files Click "Read Constant Voltage File" to read the contents of the ini file; Click "Save Constant Voltage File" to save the content of Edit cont...
INI document concept INI is a file called "INI". In fact, he itself is a text file, which can be opened with Notepad, mainly stored, the selection or system of the user, is mainly stored. C ...