|
-
August 30th, 2007, 04:37 AM
#1
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?
Cheers,
MKS
Impossible is always the one untried...
-
August 30th, 2007, 08:14 AM
#2
Re: Memcpy with unsigned long src address
 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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|