Mac fix
On macos, you can't use a wstring inside an fstream
This commit is contained in:
parent
5d24255fde
commit
17ce23a1c5
@ -368,44 +368,48 @@ public:
|
|||||||
return m_Colours[sy * nWidth + sx];
|
return m_Colours[sy * nWidth + sx];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Save(std::string sFile)
|
bool Save(std::wstring sFile)
|
||||||
{
|
{
|
||||||
std::ofstream f(sFile.c_str(), std::ios::out | std::ios::binary);
|
std::string path(sFile.begin(), sFile.end());
|
||||||
if (!f.is_open()) return false;
|
|
||||||
|
|
||||||
f.write((char*)&nWidth, sizeof(int));
|
std::ofstream f(path.c_str(), std::ios::out | std::ios::binary);
|
||||||
f.write((char*)&nHeight, sizeof(int));
|
if (!f.is_open()) return false;
|
||||||
f.write((char*)m_Colours, sizeof(short) * nWidth * nHeight);
|
|
||||||
f.write((char*)m_Glyphs, sizeof(wchar_t) * nWidth * nHeight);
|
|
||||||
|
|
||||||
f.close();
|
f.write((char*)&nWidth, sizeof(int));
|
||||||
|
f.write((char*)&nHeight, sizeof(int));
|
||||||
|
f.write((char*)m_Colours, sizeof(short) * nWidth * nHeight);
|
||||||
|
f.write((char*)m_Glyphs, sizeof(wchar_t) * nWidth * nHeight);
|
||||||
|
|
||||||
return true;
|
f.close();
|
||||||
}
|
|
||||||
|
|
||||||
bool Load(std::string sFile)
|
return true;
|
||||||
{
|
}
|
||||||
delete[] m_Glyphs;
|
|
||||||
delete[] m_Colours;
|
|
||||||
nWidth = 0;
|
|
||||||
nHeight = 0;
|
|
||||||
|
|
||||||
std::ifstream f(sFile.c_str(), std::ios::in | std::ios::binary);
|
bool Load(std::wstring sFile)
|
||||||
if (!f.is_open()) return false;
|
{
|
||||||
|
delete[] m_Glyphs;
|
||||||
|
delete[] m_Colours;
|
||||||
|
nWidth = 0;
|
||||||
|
nHeight = 0;
|
||||||
|
|
||||||
// get file data
|
std::string path(sFile.begin(), sFile.end());
|
||||||
f.read ((char*)&nWidth, sizeof(int));
|
|
||||||
f.read ((char*)&nHeight, sizeof(int));
|
|
||||||
|
|
||||||
Create(nWidth, nHeight);
|
std::ifstream f(path.c_str(), std::ios::in | std::ios::binary);
|
||||||
|
if (!f.is_open()) return false;
|
||||||
f.read ((char*)m_Colours, sizeof(short) * nWidth * nHeight);
|
|
||||||
f.read ((char*)m_Glyphs, sizeof(wchar_t) * nWidth * nHeight);
|
|
||||||
|
|
||||||
f.close();
|
// get file data
|
||||||
|
f.read((char*)&nWidth, sizeof(int));
|
||||||
|
f.read((char*)&nHeight, sizeof(int));
|
||||||
|
|
||||||
return true;
|
Create(nWidth, nHeight);
|
||||||
}
|
|
||||||
|
f.read((char*)m_Colours, sizeof(short) * nWidth * nHeight);
|
||||||
|
f.read((char*)m_Glyphs, sizeof(wchar_t) * nWidth * nHeight);
|
||||||
|
|
||||||
|
f.close();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int len = 0, done = 0, bits = 0, which = 0,
|
int len = 0, done = 0, bits = 0, which = 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user