//function GetJsonType(joI: ISuperObject): string; // begin // case joI.DataType of // stNull: Result := 'stNull'; // stBoolean: Result := 'stBoolean'; // stDouble: Result := 'stDouble'; // stInt: Result := 'stInt'; // stObject: Result := 'stObject'; // stArray: Result := 'stArray'; // stString: Result := 'stString'; // stMethod: Result := 'stMethod'; // end; // end;
function ReadBigString(const FileName, Section, Ident, DefaultStr: string): string; var PtrBuff : PChar; BuffSize, IniStrLen: integer; const BuffMax = 2048000; // some sensible value 2000K begin //https://msdn.microsoft.com/en-us/library/windows/desktop/ms724353(v=vs.85).aspx Result := ''; PtrBuff := nil; BuffSize := 204800; //200K repeat inc(BuffSize, 1024);//1K ReAllocMem(PtrBuff, BuffSize); IniStrLen := GetPrivateProfileString(PChar(Section), PChar(Ident), PChar(DefaultStr), PtrBuff, BuffSize, PChar(FileName)); //The return value is the number of characters copied to the buffer, not including the terminating null character. until (BuffSize > BuffMax) or (IniStrLen < BuffSize - 1); SetString(Result, PtrBuff, IniStrLen); FreeMem(PtrBuff); end;
posted on
浙公网安备 33010602011771号