Recent

Author Topic: User Defined Array of Bytes  (Read 1654 times)

DumDum

  • New Member
  • *
  • Posts: 32
User Defined Array of Bytes
« on: February 06, 2018, 01:07:14 am »
So as of right now this is how I set my byte array information.  It has to be inputting in the source code every time to do a new search.

ByteSequence1: array [0..2] of byte= (($AB),($A1),$FF);

Is there a way for the user to select the bytes that they want in the array?  Basically something on the command line that I can change the search parameters without having to go into the source code every time.

D

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: User Defined Array of Bytes
« Reply #1 on: February 06, 2018, 01:45:25 am »
Something like:
Code: Pascal  [Select][+][-]
  1. var
  2.   ByteSequence: array of byte;
  3.   Number_Of_Bytes_Inputted_by_User : integer;
  4.   i : integer;
  5.   UserByte : Byte;
  6. begin
  7.   Number_Of_Bytes_Inputted_by_User := ParamCount;
  8.   for i := 1 to Number_Of_Bytes_Inputted_by_User do
  9.   begin
  10.     UserByte := StrToInt(ParamStr(i));
  11.     SetLength(ByteSequence, Succ(Length(ByteSequence)));  
  12.     ByteSequence[High(ByteSequence)] := UserByte;
  13.   end;
  14.  
  15.   for UserByte in ByteSequence
  16.     do Write(HexStr(UserByte, 2), ' ');
  17.   WriteLn;
  18. end.
  19.  
perhaps ?

DumDum

  • New Member
  • *
  • Posts: 32
Re: User Defined Array of Bytes
« Reply #2 on: February 06, 2018, 02:34:43 am »
Will give it a whirl! Thanks Molly :)

 

TinyPortal © 2005-2018