William23668
Members-
Content Count
135 -
Joined
-
Last visited
Everything posted by William23668
-
stringreplace character in all string
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
love you. many thanks -
stringreplace character in all string
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
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 -
Reading a binary file hangup without error
William23668 posted a topic in RTL and Delphi Object Pascal
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; -
Reading a binary file hangup without error
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
Ok learning now about encoding. -
Reading a binary file hangup without error
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
Just for learning why the app stop responding ? if I used richedit LoadFromStream it load fine. -
Reading a binary file hangup without error
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
@Remy Lebeau Many thanks I learned many things now. I just need to read byte by byte for processing later. -
How to set TBytes array to the file size ?
William23668 posted a topic in RTL and Delphi Object Pascal
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. -
How to set TBytes array to the file size ?
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
Appreciate your help friend. -
How to set TBytes array to the file size ?
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
thanks alot. I can not open this url, does it work with you ? -
How to set TBytes array to the file size ?
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
Thanks alot guys -
How to set TBytes array to the file size ?
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
for example hex editor it display address and value ? -
How to set TBytes array to the file size ?
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
Long time I did not use Delphi. Any article to read about reading exe files ? I need to get each byte value and address. -
How to set TBytes array to the file size ?
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
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. -
How to set TBytes array to the file size ?
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
by coding. -
How to set TBytes array to the file size ?
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
read it as binary. I will want to store it into sqlite database later. -
How to set TBytes array to the file size ?
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
I want to read the file bytes and address and display in a memo -
How to set TBytes array to the file size ?
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
I edited the topic, I get error here: SetLength(MyByteArray, fsize); -
How to set TBytes array to the file size ?
William23668 replied to William23668's topic in RTL and Delphi Object Pascal
I was not clear sorry, in this line SetLength(MyByteArray, FileSize(AFile)); I get error because it expect Integer -
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.
-
Where I can find all implemented services documentation
William23668 replied to William23668's topic in FMX
Exactly Mr legend 🙂 . Wish you all great health. -
Which method I can use to convert Wordpress into Firmonkey app for mobile devices ? Rest API ?
-
yes this might work as a fast solution. the web site is already responsive so it will adjust with drawer and hamburger menu button. 🙂
-
yes it was like figure of speach to make exact web site functionality as native mobile app
-
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.
-
@Dave Nottage much appreciated