我想从文件中读取 8 个字节。
StreamReader^ sr = gcnew StreamReader( "ReadMe.txt" );
long convert = 0;
array<Char>^c = nullptr;
while ( sr->Peek() >= 0 )
{
c = gcnew array<Char>(8);
sr->Read( c, 0, c->Length );
convert = (long) c; //<- the problem
Console::WriteLine( c );
Console::WriteLine( convert );
}
但我得到这个输出:
EA00A10C <- 与文件相同
37745844 <- 错误(即使将 dec 转换为 hex)
注意:atoi 不带数组类型,我没有找到array.ToInt 函数...