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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:35:22+00:00 2026-05-25T03:35:22+00:00

I have a memory location a and I want to copy a certain amount

  • 0

I have a memory location a and I want to copy a certain amount of bytes to another location fast, how would I do this in D ?

For example how would i do this:

int main()
{
    void* src_data = 0x40001255;
    void* dst_data = 0x47F22000;
    u32 size = 0x200;
    memcpy(dst_data, src_data, size);
}

Also how would fill a struct fast:

struct data_struct
{
    u32 block1;
    u32 block2;
    u32 block3;
    u32 block4;
    u32 block5;
    u62 block6;
    u128 bigblock;
} data_struct_t;

int main()
{
    void* src_data = 0x40001255;
    struct data_struct_t dst_data; 
    u32 size = sizeof(data_struct);
    memcpy(dst_data, src_data, size);
}

Thanks!
Roel

  • 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-25T03:35:23+00:00Added an answer on May 25, 2026 at 3:35 am

    Assigning to a slice will perform an array copy, which calls memcpy internally.

    
    void main()
    {
        void* src_data = 0x40001255;
        void* dst_data = 0x47F22000;
        uint size = 0x200;
        dst_data[0..size] = src_data[0..size];
    }
    

    For the second one:

    
    struct data_struct
    {
        uint block1, block2, block3, block4, block5;
        ulong block6;
        uint[4] bigblock;
    }
    
    void main()
    {
        auto src_data = cast(data_struct*) 0x40001255; // unaligned, WTF?!
        auto dst_data = *src_data;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to get the start memory location of a process in c# I have
I have a memory block that is divided into a series of location that
Ignoring unsafe code, .NET cannot have memory leaks. I've read this endlessly from many
i have the memory address of certain register(the address LCDCW1 is C000). c codes:
Suppose I have a structure, and a pointer to a memory location p, how
I have this modified code example I took from the wikipedia article on anonymous
Two Windows processes have memory mapped the same shared file. If the file consists
Does gcc have memory alignment pragma, akin #pragma vector aligned in Intel compiler? I
I am trying to load an image in memory but might have memory issues
I have vague memory of a screenshot of a VS plugin that colors different

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.