procedure TForm1.Button1Click(Sender: TObject); var i,i2:Integer ; data:array of byte; s:string; hfile:THandle; byteswrite:dWord; begin s:='486F6D65B9E6B8F1A3BA'; i2:=Length(s) div 2; SetLength(data,i2); for i:=0 to Length(data)-1 do begin data[i]:=StrToInt('$'+copy(s,i*2+1,2)); Edit1.Text :=Edit1.Text + inttohex(data[i],2); end; hFile := CreateFile('xxx.txt',GENERIC_READ or GENERIC_WRITE,FILE_SHARE_READ,nil,CREATE_ALWAYS,0,0); if hFile = INVALID_HANDLE_VALUE then Exit; WriteFile(hFile,data[0],Length(data),BytesWrite,nil); CloseHandle(hFile); end;