Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6939221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:35:40+00:00 2026-05-27T12:35:40+00:00

I have variable: data: TIdBytes; it contains some amount of data. How to read

  • 0

I have variable:

data: TIdBytes;

it contains some amount of data.

How to read first byte of “data”, and delete the first byte from “data” ?

And yes, I will do it again and again. Until “data” will be empty.

I will use the copied byte with “IF”

if $0F = Copiedbyte then
 do_somthing;

maybe deleting is not so necessary, I just can copy next byte..

I don’t need loop, i just need to copy one byte the do something with it, for example save for later use.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:35:40+00:00Added an answer on May 27, 2026 at 12:35 pm

    You don’t need to delete anything and it seems wasteful to do so. It would make your code messier and cost CPU time.

    Just iterate over the array of bytes:

    var
      b: byte;
    ....
    for b in data do
      dosomething(b);
    

    If you don’t want to do this in a loop, keep track of the index of the next byte to be processed. Every time you process a byte, increment the index.

    function GetNext(
      const data: TIdBytes;
      var Index: Integer; 
      var b: Byte
    ): Boolean;
    begin
      Result := Index<=high(data);
      if Result then
      begin
        b := data[Index];
        inc(Index);
      end;
    end;
    

    Initialise an index variable to 0 and keep calling this function, extracting one byte at a time, until it returns False.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a date variable that contains data in the forma: DD-MM-YY. -> $date
In the Firefox extension I'm writing, I have a variable containing some data that
I'm trying to parse returned information that can have a variable amount of data
I have a task to store large amount of gps data and some extra
I am trying to make some data from database available using XML, I have
I have a request(POST or GET), having one variable data (coming from Xcode) now
I have a variable data , the type of variable is: TIdBytes . Variable
On my website I have a variable called $user_data that contains input from a
If i have my form elements with values in variable data (contains: var data
I have a page-scoped component, which has an instance variable List with data, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.