Jump to content

William23668

Members
  • Content Count

    135
  • Joined

  • Last visited

Everything posted by William23668

  1. William23668

    stringreplace character in all string

    love you. many thanks
  2. William23668

    stringreplace character in all string

    I test it with this line fstr := 'MZ'#$0090#0#3#0#0#0#4#0#0#0'ÿÿ'#0#0'¸'#0#0#0#0#0#0#0''; fstr := stringreplace(fstr,'#0','0',[rfReplaceAll, rfIgnoreCase]); output is (copied from the watch window) 'MZ'#$0090#0#3#0#0#0#4#0#0#0'ÿÿ'#0#0'¸'#0#0#0#0#0#0#0
  3. Hi I was able to read the file byte by byte but the app hangup/not responding I dont know why ? Here is the code: var AFile: TFileStream; BR: TBinaryReader; MyByteArray: TBytes; mstr: String; i: integer; begin AFile := TFileStream.Create(filename, fmOpenRead); BR := TBinaryReader.Create(AFile, TEncoding.Unicode, false); try SetLength(MyByteArray, AFile.Size); // Get the whole file contents into the byte array MyByteArray := BR.ReadBytes(AFile.Size); for i := low(MyByteArray) to High(MyByteArray) do begin SetString(mstr, PAnsiChar(@MyByteArray[i]), Length(MyByteArray)); RichEdit1.Text := RichEdit1.Text + mstr; end; BR.Close; finally BR.Free; AFile.Free; end; end;
  4. William23668

    Reading a binary file hangup without error

    Ok learning now about encoding.
  5. William23668

    Reading a binary file hangup without error

    Just for learning why the app stop responding ? if I used richedit LoadFromStream it load fine.
  6. William23668

    Reading a binary file hangup without error

    @Remy Lebeau Many thanks I learned many things now. I just need to read byte by byte for processing later.
  7. Hi I am using TFileStream to read and write binary file and I want to read the entire file bytes and the address of each byte so I started like that: procedure ReadBinary(filename: string); var AFile: TFileStream; BR: TBinaryReader; AInteger: Integer; ADouble: Double; AChar: Char; AString: String; MyByteArray: TBytes; fsize: nativeint; begin AFile := TFileStream.Create(filename, fmOpenRead); BR := TBinaryReader.Create(AFile, TEncoding.Unicode, false); try fsize := FileSize(AFile); // Declare our array to hold the returned data SetLength(MyByteArray, fsize); // Get the whole file contents into the byte array MyByteArray := BR.ReadBytes(FileSize(AFile)); memo1.lines.add(TEncoding.Unicode.GetString(MyByteArray)); // read an integer and write it to the console AInteger := BR.ReadInteger; memo1.lines.add('integer:'+AInteger.ToString); // read a double and write it to the console ADouble := BR.ReadDouble; memo1.lines.add('double:'+ADouble.ToString); // read a char and write it to the console AChar := BR.ReadChar; memo1.lines.add('char:'+AChar); // read a string and write it to the console AString := BR.ReadString; memo1.lines.add('string:'+AString); BR.Close; finally BR.Free; AFile.Free; end; end; I need to set the size of the MyByteArray to the size of the file so I used FileSize but it is NativeInt while I need ineteger how to convert NativeInt to Integer to set the length of the array ? SetLength(MyByteArray, FileSize(AFile)); the code above for learning so it has more lines I dont need.
  8. William23668

    How to set TBytes array to the file size ?

    Appreciate your help friend.
  9. William23668

    How to set TBytes array to the file size ?

    thanks alot. I can not open this url, does it work with you ?
  10. William23668

    How to set TBytes array to the file size ?

    for example hex editor it display address and value ?
  11. William23668

    How to set TBytes array to the file size ?

    Long time I did not use Delphi. Any article to read about reading exe files ? I need to get each byte value and address.
  12. William23668

    How to set TBytes array to the file size ?

    I tried now to use this code: SetLength(MyByteArray, AFile.Size); MyByteArray := BR.ReadBytes(AFile.Size); memo1.lines.add(TEncoding.Unicode.GetString(MyByteArray)); but I get something like this 婍 from exe file.
  13. William23668

    How to set TBytes array to the file size ?

    read it as binary. I will want to store it into sqlite database later.
  14. William23668

    How to set TBytes array to the file size ?

    I want to read the file bytes and address and display in a memo
  15. William23668

    How to set TBytes array to the file size ?

    I edited the topic, I get error here: SetLength(MyByteArray, fsize);
  16. William23668

    How to set TBytes array to the file size ?

    I was not clear sorry, in this line SetLength(MyByteArray, FileSize(AFile)); I get error because it expect Integer
  17. Hi I tried to google and found https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Android_Mobile_Application_Development But I am looking for a list of available services documentation for FMX, where I can find this ? Delphi 11.
  18. William23668

    Where I can find all implemented services documentation

    Exactly Mr legend 🙂 . Wish you all great health.
  19. William23668

    Wordpress to Firemonkey

    Which method I can use to convert Wordpress into Firmonkey app for mobile devices ? Rest API ?
  20. William23668

    Wordpress to Firemonkey

    yes this might work as a fast solution. the web site is already responsive so it will adjust with drawer and hamburger menu button. 🙂
  21. William23668

    Wordpress to Firemonkey

    yes it was like figure of speach to make exact web site functionality as native mobile app
  22. William23668

    Wordpress to Firemonkey

    Convert Wordpress web application into mobile app . There are services like this https://www.appmysite.com/wordpress-mobile-app-builder/ but I was hoping I can do it using Delphi Firemonkey.
  23. William23668

    DRM video player

    @Dave Nottage much appreciated
×