警告:
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( ) );