Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie question: read from memory

Status
Not open for further replies.

Hermanator

Technical User
Jan 16, 2002
30
NL
Hello,

I'm quit a newbie on C++. I need to do something, that I believe shouldn't be very hard.
I want to make a function that reads from a certain memory address, and for a certain length.
For example: I give the function 2 arguments: The memory address, and the lenght of the data. Than the function returns a array, filled with the data found at that address.

How do I do that ?

Thanks !
 
void* function(int address, ins size)
{
char* x = (char*)address;
char* data = new char[size];
for(int i = 0; i < size; i++)
{
data = x;
}
return (void*) data;
} Ion Filipski
1c.bmp


filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top