Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

copy block of memory

Tags:

c++

memory

copy

I need a suggestion on on how do I copy a block of memory efficiently, in single attempt if possible, in C++ or assembly language.

I have a pointer to memory location and offset. Think of a memory as a 2D array that I need to copy consisting of rows and columns.

like image 621
Abdul Khaliq Avatar asked Jun 03 '09 11:06

Abdul Khaliq


People also ask

How do I copy bytes in C++?

void* memcpy( void* dest, const void* src, std::size_t count ); Copies count bytes from the object pointed to by src to the object pointed to by dest . Both objects are reinterpreted as arrays of unsigned char. If the objects overlap, the behavior is undefined.

What is meant by memcpy in C++?

memcpy() function is an inbuilt function in C++ STL, which is defined in <cstring> header file. memcpy() function is used to copy blocks of memory. This function is used to copy the number of values from one memory location to another. The result of the function is a binary copy of the data.

What is Memmove function in C?

Description. The memmove() function copies count bytes of src to dest. This function allows copying between objects that might overlap as if src is first copied into a temporary array.

What is a memory copy?

Description: A copy from the storage specified by source string to the storage specified by target string is performed.


1 Answers

How about std::memcpy?   

like image 126
Aistina Avatar answered Oct 13 '22 17:10

Aistina