blob: 48fc374ab14c8e19af7330468384da47b1d8d5ea (
plain)
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
|
#include <RemoteCode/FileReader.hpp>
namespace RemoteCode
{
bool FileReader::Start(const char *FileName)
{
std::ifstream File(FileName, std::ios::in | std::ios::binary);
// File does not exist/is not open.
if(!File.is_open())
return false;
// Do not skip white-space, read file.
File.unsetf(std::ios::skipws);
m_Contents.insert(
m_Contents.begin(),
std::istream_iterator<uint8_t>(File),
std::istream_iterator<uint8_t>()
);
if(m_Contents.empty())
return false;
// Close the handle.
File.close();
return true;
}
}
|