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

  • SEARCH
  • Home
  • 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 8715153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:46:49+00:00 2026-06-13T05:46:49+00:00

My basic task is to get a subset of an buffer-array into another buffer

  • 0

My basic task is to get a subset of an buffer-array into another buffer array:

char buffer[max_len];

unit8 *pDestBuffer;

I used this code, because I would like to stay in ANSI-C:

memcpy(pDestBuffer, buffer, 4);

However – something must be wrong, because I don’t get my result as I expect to. Because, when I debug buffer, I see all the slots of the array – when I do this with pDestBuffer, I get only one Item – which I can change however, with something like memset(pDestBuffer,1,4)

pDestBuffer is part of a structure, and the only other reference to it, besides the definition above, was were these lines:

requiredMemory = sizeof(Structure) + bufferSize;
pStructure = (Structure *)HostMalloc(requiredMemory);
pStructure->pDestBuffer = ((uint8 *)pStructure)+sizeof(Sturcture);

I know, this might be rather a basic task, and I am working on this myself, but please, if there is a “best-practice” for this or you know a solution, please share it with me.

As a twist, I would really like to know, if there might be an improved way for this, using the boost-libraries, which I do use anyways for other problems.

  • 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-06-13T05:46:50+00:00Added an answer on June 13, 2026 at 5:46 am

    Your code is working. Just because your debugger cannot see the data doesn’t mean it’s not there. What’s happening is that your code says uint8_t * pDestbuffer; so your debugger thinks that pDestBuffer is just a pointer to a single byte, so that’s what it shows. You know however that it’s actually a pointer to an array.

    There may be some way of telling your debugger that this is an array so you can see all the data. For instance, one debugger I know would let you type in pStructure->pDestBuffer,4 to say show me four bytes not just one.

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

Sidebar

Related Questions

I have some basic idea on how to do this task, but I'm not
This looks quite a basic task, but I cannot sort it out. The PyEphem
This is a super basic task, but I can't find documentation on it. I
Considering that this is a very basic task, I could not think of an
I am working on a very basic NHibernate 3.2 task, inserting records into existing
Another watir issue. This code works until add_task ... After login, the auth window
I'm trying to make a basic multiprocessing task and this is what I have.
Basic question here - I have many lines of code that look something like:
Basic doubt...If QTP generates vbscript code as we record actions, can't we directly write
Basic C# syntax question: So I have this class public class BrandQuery<T> : Query<T>

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.