Memcpy with unsigned long src address
I have declared an unsilgned long;
char *reg = new char(reg_size);
unsigned long reg_address = 1bece08;
reg_address = reg_address | 0xe0000000;
memcpy(reg, (const void *) reg_address, reg_size);
memcpy is not working, as I am always getting junk values in them. I also tried memset, but no use?
Please let me know if anything is visibly wrong?
Re: Memcpy with unsigned long src address
Quote:
Originally Posted by srikanth_mk
I have declared an unsilgned long;
char *reg = new char(reg_size);
What does the last line do? It allocates a single character, and assigns the value of reg_size to it.
This is what you want to do:
Code:
char *reg = new char [reg_size];
Regards,
Paul McKenzie