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 765175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:50:51+00:00 2026-05-14T16:50:51+00:00

I am working with a binary file structure. The code example for reading the

  • 0

I am working with a binary file structure. The code example for reading the data is in C, and I need to read it in Delphi. I hasten to add I have no C programming experience.

Given the following

typedef struct {
uchar ID, DataSource;
ushort ChecksumOffset;
uchar Spare, NDataTypes;
ushort Offset [256];
} HeaderType; 

...

typedef struct {
ushort ID;
...
ushort DistanceToBin1Middle,TransmitLength;
} FixLeaderType;

...

HeaderType *HdrPtr;
FixLeaderType *FLdrPtr;

unsigned char RcvBuff[8192];
void DecodeBBensemble( void )
{
unsigned short i, *IDptr, ID;
FLdrPtr = (FixLeaderType *)&RcvBuff [ HdrPtr->Offset[0] ];
if (FLdrPtr->NBins > 128)
FLdrPtr->NBins = 32;

...

The bit I am having difficulty following is this:

FLdrPtr = (FixLeaderType *)&RcvBuff [ HdrPtr->Offset[0] ];

From the little I understand, [ HdrPtr->Offset[0] ]; would be returning the value of the first Offset array item from the HeaderType struct pointed to by HdrPtr? So equivalent to HdrPtr^.Offset[0] ?

Then &RcvBuff [ HdrPtr->Offset[0] ]; should be returning the memory address containing the value of the RcvBuff array item indexed, so equivalent to @RecBuff[HdrPtr^.Offset[0]] ?

Then I get lost with (FixLeaderType *).. . Could someone please help explain exactly what is being referenced by FldrPtr ?

  • 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-14T16:50:52+00:00Added an answer on May 14, 2026 at 4:50 pm

    The bits of code that are relevant are

    FixLeaderType *FLdrPtr; 
    unsigned char RcvBuff[8192]; 
    
    FLdrPtr = (FixLeaderType *)&RcvBuff [ HdrPtr->Offset[0] ]; 
    
    1. FldPtr is of type FixLeaderType *, or pointer to FixLeaderType.
    2. RcvBuff is an array of char.
    3. HdrPtr->Offset[0] resolves to an ushort value, so RcvBuff [ HdrPtr->Offset[0] ] yields a char value.
    4. The & means that instead of getting the value of the char the address of the value is returned. Note that this means that it is of type char *.
    5. The char * type is the wrong type to assign to FldPtr. The (FixLeaderType *) converts the type so that it is valid. This is called a cast operation.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 512k
  • Answers 512k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I may be misunderstanding the question, but if you want… May 16, 2026 at 5:45 pm
  • Editorial Team
    Editorial Team added an answer Using abort will dump core, if the user has core… May 16, 2026 at 5:45 pm
  • Editorial Team
    Editorial Team added an answer XSLT doesn't know anything about the variables in the (VB.NET)… May 16, 2026 at 5:45 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

For some graphics work I need to read in a large amount of data
I've been working on this assignment, where I need to read in records and
The system I'm currently working on involves the creation of binary decision trees. Lots
Lately, I've been working on some small data serialization demos. However, I was wondering
I am currently working on my own little project, but I have a little
I'm using serialization for save feature in my application. But when the data is
I have a project that is stored in a Subversion repository. In this repository,
I'm working on playing audio from an audio stream using VC++ with the QtMultimedia
I export try.jar file using 32 bit java libraries. On the client site, I
I have a php script that I have used for years to force downloads

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.