警告:
warning C4244: 'initializing' : conversion from 'std::streamoff' to 'unsigned int', possible loss of data
のせいで:
unsigned int FileSize = File.tellg( ); // WARNING
std::cout << "Size = " << FileSize << std::endl;
考えられる解決策は?これを行っても大丈夫ですか:
// No more warnings but, is it safe?
unsigned int FileSize = (unsigned int)File.tellg( ); // OK?
std::cout << "Size = " << FileSize << std::endl;
これはどう?
// No more warnings but, is it safe?
unsigned int FileSize = static_cast< unsigned int >( File.tellg( ) );