UInt64和string之间如何转换?
我要在ini中写入uint64类型,用 writeinteger不行
转换一下后可以写入
WriteString('STR', 'UInt64', UIntToStr(ui64));
但是读出的话不行了,比如值18446744073709551615,StrToInt64是不行的
[解决办法]
var
Ini : TiniFile;
U64 : UInt64;
begin
U64 := $FFFFFFFFFFFFFFFF;
Ini := TIniFile.Create('E:\dd.ini');
Ini.WriteString('Root' , 'Key' , IntToHex(U64 , 8));
U64 := StrToInt64Def('$' + Ini.ReadString('Root' , 'Key' , ''),0);
Ini.Free;
if U64=$FFFFFFFFFFFFFFFF then
ShowMessage('ok');
end;
18446744073709551615=$FFFFFFFFFFFFFFFF刚好64位