I have the ability to read the memory with Lua, but I've run into a problem.
I want to read a float value.
I have, what I presume to be a float, in the memory which looks like this.
Byte Array 65 B6 40 43 EC 35 87 41 51 04 9E 3F
Float Value 192.712478637695
I know the float value because I'm using a memory editor.
In Lua I have a fun...
Imaging having a stack of protocols and some c/cpp code that neatly covers
sending on each layer. Each send function uses the layer below to add
another header until the whole message is eventually placed into a
continuous global buffer on layer 0:
void SendLayer2(void * payload, unsigned int payload_length)
{
Layer2Header header; ...
I am trying to use a memcpy for a size of 200K, and it stucks!!!
Both destb and source are allocated.
What could be the reason for this issue?
...
I have an array that is like this:
unsigned char array[] = {'\xc0', '\x3f', '\x0e', '\x54', '\xe5', '\x20'};
unsigned char array2[6];
When I use memcpy:
memcpy(array2, array, 6);
And print both of them:
printf("%x %x %x %x %x %x", array[0], // ... etc
printf("%x %x %x %x %x %x", array2[0], // ... etc
one prints like:
c0 3f e 5...
I have some software that I have working on a redhat system with icc and it is working fine. When I ported the code to an IRIX system running with MIPS then I get some calculations that come out as "nan" when there should definitely be values there.
I dont have any good debuggers on the non-redhat system, but I have tracked down that so...
I have a C program which loads a file line-by-line into one string and then memcpy's this string into another string pointer using this code:
typedef struct inmod_struct {
Int32 ReturnCode;
Int32 Length;
char Body[ROWSIZE];
} inmdtyp,*inmdptr;
inmdptr inmodptr;
char line[600];
int doit()
{
...
The key difference between memcpy() and memmove() is that memmove() will work fine when source and destination overlap. When buffers surely don't overlap memcpy() is preferable since it's potentially faster.
What bothers me is this potentially. Is it a microoptimization or are there real significant examples when memcpy() is faster so t...
Hi folks,
I fall in some problem.
I need to write some function like memcpy(void*, const void*), which its signature should be:
void arrayCopy(void *dest, int dIndex, const void *src, int sIndex, int len)
I noticed that, in many implementation of memcpy, we cast void* to char*, but I think this is not the case of me, as the arrayCop...
Hi guyz,
The following program doesn't output desired data (on VC2008 compiler)
#include <stdio.h>
#include <string.h>
int main(void)
{
int i;
int dest[10] = {1};
int src [] = {2, 3, 4, 5, 6};
memcpy(dest, src, 5);
for (i=0; i<10; i++) printf("%i\n", dest[i]);
return 0;
}
whereas using char arrays instead, ...
I can think of some nasty inefficient ways to accomplish this task, but I'm wondering what the best way is.
For example I want to copy 10 bytes starting at the 3rd bit in a byte and copy to a pointer as usual.
Is there a better way than to copy one shifted byte at a time?
Thanks
...
Do I need to treat cases when I actully have nothing to move/copy with memmove()/memcpy() as edge cases
int numberOfBytes = ...
if( numberOfBytes != 0 ) {
memmove( dest, source, numberOfBytes );
}
or should I just call the function without checking
int numberOfBytes = ...
memmove( dest, source, numberOfBytes );
Is the check in ...
Hi everybody,
I have the problem that memcpy/memmove change the pointer of a struct FOO foo, which is neither src nor destination of the function. Here are the gdb outputs:
Before memmove(y,y_temp,size_y);:
(gdb) p y
$38 = 0xbff7a2e0
(gdb) p y_temp
$39 = (float *) 0x815ea20
(gdb) p foo
$40 = (FOO *) 0x81d4e90
and after:
(gdb) p y_t...
Say we have two arrays:
double *matrix=new double[100];
double *array=new double[10];
And we want to copy 10 elements from matrix[80:89] to array using memcpy.
Any quick solutions?
Thanks
...
Hey everyone,
I have a class for an RDT Header that holds information for an implementation of several reliable data transfer protocols. I need to attach that information (a total of 12 bytes) to my send buffer to transfer it over the socket. I am trying to use memcpy to do this but for some reason it just leaves junk inside the buffer....
Guys,
I want to copy elements of a struct array to another by using memcpy. I believe this is miserably causing my program to fail for some reason. Also how can I free the memory in the end ?
struct FaultCodes
{
string troubleFound;
string causeCode;
string actionCode;
string paymentCode;
string suppCode;
u_int16_t multipli...
Hi guys,
I'm currently working on a iPhone STG. I developed the system based on a 2D graphic engine developed by other engineers. Both are based on C++.
The game run extremely slow on 3GS(about 5~10 fps). I tried 2 version of iOS: 4.1 and 3.1.2, both very slow.
But when I installed the game on an iPhone (yes only "iPhone". Not 3G. Not ...