-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathIniWriter.cpp
More file actions
30 lines (30 loc) · 1000 Bytes
/
IniWriter.cpp
File metadata and controls
30 lines (30 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "IniWriter.h"
#include <iostream>
#include <Windows.h>
IniWriter::IniWriter(char* szFileName)
{
memset(m_szFileName, 0x00, 255);
memcpy(m_szFileName, szFileName, strlen(szFileName));
}
void IniWriter::WriteInteger(char* szSection, char* szKey, int iValue)
{
char szValue[255];
sprintf(szValue, "%d", iValue);
WritePrivateProfileString(szSection, szKey, szValue, m_szFileName);
}
void IniWriter::WriteFloat(char* szSection, char* szKey, float fltValue)
{
char szValue[255];
sprintf(szValue, "%f", fltValue);
WritePrivateProfileString(szSection, szKey, szValue, m_szFileName);
}
void IniWriter::WriteBoolean(char* szSection, char* szKey, bool bolValue)
{
char szValue[255];
sprintf(szValue, "%s", bolValue ? "True" : "False");
WritePrivateProfileString(szSection, szKey, szValue, m_szFileName);
}
void IniWriter::WriteString(char* szSection, char* szKey, char* szValue)
{
WritePrivateProfileString(szSection, szKey, szValue, m_szFileName);
}