std::vector<char> file_buffer;
std::wstring str;
if ( GetFileStream( TEXT(".\\Test_Program.txt"), file_buffer) )
{
str.resize( file_buffer.size(), 0);
MultiByteToWideChar( CP_ACP, 0, &file_buffer.front(), -1,
&str.front(), str.size() );
}
#include <fstream>
#include <vector>
bool GetFileStream( LPCTSTR lpFileName, std::vector<char>& buffer)
{
std::ifstream ifs;
ifs.open( lpFileName, std::ios::in | std::ios::binary );
if ( ! ifs )
return false;
ifs.seekg( 0, std::ios::end );
size_t size_of_resource = static_cast<size_t>( ifs.tellg());
if ( size_of_resource == 0 )
return false;
buffer.resize( size_of_resource + 1, 0);
ifs.seekg( 0, std::ios::beg );
ifs.read( &buffer.front(), size_of_resource );
ifs.close();
return true;
}