Jump to content

William23668

Members
  • Content Count

    117
  • Joined

  • Last visited

Everything posted by William23668

  1. will try to reinstall again, thanks solved...
  2. Thanks this is the last version 28.0.46141.0937 ?
  3. Hi I am using this code to create the database bute I get error on connect : var MyDBFile: string; begin MyDBFile := 'C:\db5.sqlite3'; if FileExists(MyDBFile) then DeleteFile(MyDBFile); FDConnection1.Params.Values['Database'] := MyDBFile; FDConnection1.Params.Values['DriverID'] := 'SQLite'; //Connection.Params.Values['Encrypt'] := 'aes-128'; //Connection.Params.Values['Password'] := '1234'; FDConnection1.Connected := True; --------------------------- [FireDAC][Phys][SQLite] ERROR: unable to open database file. ---------------------------
  4. William23668

    Unable to create sqlite database at runtime with firedac

    wow this solved the problem, I never read about this parameter before. many thanks
  5. William23668

    Unable to create sqlite database at runtime with firedac

    I dont understand !! the code display error on connect so it does not connect or create a file.
  6. I have string like this 84@fgl#000^2#0#0 94j@f#0 And I tried to replace all '#0' with '0' like this result := stringreplace(OriginalStr, '#0', '0',[rfReplaceAll, rfIgnoreCase]); But this did not replace all the '#0' , how I should use this ?
  7. William23668

    stringreplace character in all string

    No it was just to practice.
  8. William23668

    stringreplace character in all string

    love you. many thanks
  9. 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
  10. 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;
  11. William23668

    Reading a binary file hangup without error

    Ok learning now about encoding.
  12. William23668

    Reading a binary file hangup without error

    Just for learning why the app stop responding ? if I used richedit LoadFromStream it load fine.
  13. 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.
  14. 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.
  15. William23668

    How to set TBytes array to the file size ?

    Appreciate your help friend.
  16. William23668

    How to set TBytes array to the file size ?

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

    How to set TBytes array to the file size ?

    for example hex editor it display address and value ?
  18. 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.
  19. 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.
  20. William23668

    How to set TBytes array to the file size ?

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

    How to set TBytes array to the file size ?

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

    How to set TBytes array to the file size ?

    I edited the topic, I get error here: SetLength(MyByteArray, fsize);
  23. 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
×