-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathLanguage.cpp
51 lines (40 loc) · 963 Bytes
/
Language.cpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "stdafx.h"
#include <string>
#include "language.h"
CLanguage::CLanguage()
= default;
CLanguage::~CLanguage()
= default;
void CLanguage::read_language(const LPCSTR file_name)
{
CStdioFile file;
if (!file.Open(file_name, CFile::modeRead | CFile::typeBinary))
{
char buffer[1024];
sprintf(buffer, "Can't read language file\nFile:'%s'", file_name);
MessageBox(nullptr, buffer, "Caution!!", MB_OK);
return;
}
int i = 0;
CString line;
while (file.ReadString(line))
{
if (line.IsEmpty())
{
break;
}
// Convert CString to std::string
CT2CA pszConvertedAnsiString(line);
std::string strStd(pszConvertedAnsiString);
if (strStd[0] != '#')
{
m_Str[i].Format("%s", strStd.c_str());
i++;
}
if (i >= STRING_COUNT)
{
break;
}
}
file.Close();
}