Questions tagged [memmove]

memmove() is a C standard library function to copy a block of memory. It work even if the source and the destination overlap.

144 questions
-1
votes
2 answers

memmove only moving half the numbers

Having a problem moving a 2D array of doubles. In the code below, I have double Weights[wt][2] I can move the Weights[0][0] to Weights[0][1], but only by adding "*2" to the end of how many bytes to move. Why when I use "wt * sizeof(double)" it only…
-1
votes
1 answer

Using memmove with pointer

I searched all over StackOverflow but could not find exactly what I am trying to do. I'd like to copy pointer Items over to pointer COPYTO. Then able to call COPYTO->x. #include typedef struct JustArray { char x[30]; }…
-1
votes
1 answer

C++: Copying Objects Using Memmove and Malloc

I was playing around templates when I was surprised that the code below doesn't work as expected: #include #include #include template class CreatorTWO { public: CreatorTWO (void) {} ~CreatorTWO…
R34
  • 59
  • 6
-1
votes
1 answer

Making memmove() safe using realloc()

In my function to replace a substring. If the input substring is longer than the original one, it moves part of the input string out to make room for the input substring. I understand this results in undefined behavior. I thought I should be able to…
oraz
  • 277
  • 1
  • 6
  • 14
-1
votes
3 answers

Safe use of memcpy on overlapping region

Is it safe to use memcpy in the following scenario, where one is copying data from larger index into a block to smaller index in the same block. For example: char buf[100]; // fill in the data ... memcpy(&buf[10], &buf[15], 10); In the above…
-1
votes
1 answer

Please look into this inexplicable behavior and output of memcpy() for overlapping memory blocks

After reading the following about memcpy(), I proceeded to read about memmove(): To avoid overflows, the size of the arrays pointed by both the destination and source parameters, shall be at least num bytes, and should not overlap (for overlapping…
Rüppell's Vulture
  • 3,583
  • 7
  • 35
  • 49
-1
votes
2 answers

Bus error when using memmove

Possible Duplicate: Bus error troubleshooting To remove duplicates from a string this is the program I have written: #include #include #include void remDup(char str[]) { int i=0,len; int arr[256]={[0 ... 255] =…
-2
votes
2 answers

Shifting array elements leaves last elements blank

i'm currently working on a project where I'm averaging the output of the last 10 to 20 measurements. to do this I'm saving the last 10 values in an array. right shifting the elements to update the data. The code that I'm using to shift the…
Ron
  • 155
  • 12
-2
votes
1 answer

memmove (MSDN) - the quick brown fox/dog

I read the MSDN article on memmove here: http://msdn.microsoft.com/en-us/library/aa246469%28v=vs.60%29.aspx and I cannot tell from their example how memmove differ from memcpy. they both give the same outcome though the example is to show the…
CaTx
  • 1,421
  • 4
  • 21
  • 42
1 2 3
9
10