Get Specific Hex value from Hex file lazarus / 10-Designer ---------------------------------------------------------------------- fiazhnd · 2017-06-13 08:17 Can someone please explain to me in simple way how i get hex value from a file after open required data like this (a byte, word, Dword and hex value 8 byte long) from Hex offset 0x010 into edit1 and so on. ---------------------------------------------------------------------- Pascal · 2017-06-13 08:28 Try SysUtils.Fomat: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i hextringbyte := format('%x', [bytevar]);hexstringword := format('%x', [wordvar]);hexstringdword := format('%x', [dwordvar]); ---------------------------------------------------------------------- fiazhnd · 2017-06-13 08:31 But How indicate the offset of hex file? ---------------------------------------------------------------------- Thaddy · 2017-06-13 08:34 Quote from: fiazhnd on June 13, 2017, 10:31:45 amBut How indicate the offset of hex file? Use a filestream...? Sound like homework to me... Btw: https://www.freepascal.org/docs-html/rtl/classes/bintohex.html ---------------------------------------------------------------------- fiazhnd · 2017-06-13 08:59 Boss issue is simple if i know how to use filestream to extract value i wasn't asked at what i want if someone just writes small code to extract value from 0x10. that will be really helpful ---------------------------------------------------------------------- Thaddy · 2017-06-13 09:05 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program gotopos;{$mode objfpc}uses classes;var s:TFilestream;begin s:=TFilestr eam.Create('', fmOpenRead); try  s.Position := $10;  // whatever; finally  s.free;end;end.  But I would write code that tests: - if the file exists - if it is indeed bigger than 16 bytes - etc... ---------------------------------------------------------------------- fiazhnd · 2017-06-13 12:06 Thank you Thaddy i think i am near what i wanted but still materially wrong  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button5Click(Sender: TObject); var filename: string; s:TFilestream;begin  if openDialog1.Execute then begin    filename := openDialog1.Filename; s:=TFilestream.Create(filename, fmOpenRead); try  s.Position := $10;  // whatever; finally  Edit1.Text:=IntToStr($10);  s.free;end;  end;Closefile(Filename);end; ---------------------------------------------------------------------- howardpc · 2017-06-13 13:37 You could use something like this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure ShowValuesAtHex10(const aFilename: string; const aMemo: TMemo);var  fs: TFileStream;  q: QWord;  d: DWord absolute q;  w: Word absolute q;  b: Byte absolute q;begin  if FileExists(aFilename) and (FileSize(aFilename) > $20)  and Assigned(aMemo) then begin    fs:=TFilestream.Create(aFilename, fmOpenRead);    try      fs.Position:=$10;      q:=fs.ReadQWord;      aMemo.Clear;      aMemo.Append(Format('Byte:  %x',[b]));      aMemo.Append(Format('Word:  %x',[w]));      aMemo.Append(Format('DWord: %x',[d]));      aMemo.Append(Format('QWord: %x',[q]));    finally      fs.free;    end;  end;end; called using something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if OpenDialog1.Execute then    ShowValuesAtHex10(OpenDialog1.FileName, Memo1); ---------------------------------------------------------------------- fiazhnd · 2017-06-13 15:05 Thank you, soo much work like a charm. ---------------------------------------------------------------------- fiazhnd · 2017-06-13 17:53 Mates, can i know why i received value of hex swap B8B479A4B9BF78FF instead of FF78BFB9A479B4B8 in Qword? ---------------------------------------------------------------------- howardpc · 2017-06-13 18:04 Google for endianness, bigendian, littleendian.