Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Need help with Delphi

Featured Replies

Posted

I started playing with Delphi again after a couple of years and now I am feeling dumb, really dumb. Is there a function in Delphi that reads an ascii string, say 54 2D 72 61 64 (T-rad) as 64 00 00 00 54 2D 72 61 (d...T-ra) string type

 

Thanks for any help

T-rad

I'm not sure if I understand you correctly. :)

Zero-terminated strings are "PChar" in Delphi. Or "PAnsiChar" in later versions. They have nothing in front of them.
Delphi strings have dword in front of them, telling string length (and some other stuff you don't care about). So, to get "64 00 00 00" in front of string, you just set it's length to 0x64.

Example code:

uses Windows, Classes, Sysutils;
var
   p : PAnsiChar;
   s : AnsiString;
begin
   p := 't-rad';       // 00413314  74 2D 72 61 64 00 00 00                          t-rad...
   s := p;             // 02230FC0  05 00 00 00 74 2D 72 61 64                       �...t-rad
   SetLength(s, 100);  // 022226A8  64 00 00 00 74 2D 72 61 64                       d...t-rad
end.

Is this what you needed?

 

  • Author

thanks.. but I'm not sure i stated it correctly. the string is divided into DWORD's and looks to be reversed. If the string were in groups of four there would be no 0 bytes following the last char.

a longer example...."T-rad123456789" would look like this 38 39 00 00 34 35 36 37 64 31 32 33 54 2D 72 61 (89..4567d123T-ra) instead of this 74 2D 72 61 64 31 32 33 34 35 36 37 38 39 00 00 (T-rad123456789).

Hope this makes sense.

Thanks

Ok, that's something totally different, I misunderstood your question. :) 

I don't think there is a standard function for something like that.. In addition to that, it's quite uncommon to have 00 inside the strings. 

 

 

  • Author
Spoiler
Spoiler

 

Edited by T-rad
post incorrect

  • Author

thanks

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.