I am trying to write a program that reads the contents in the memory.
How can i assign to the pointer the memory addr given by the user as the starting addr and tell it read on till it reaches the ending addr specified by the user?
I am trying to write a program that reads the contents in the memory.
How can i assign to the pointer the memory addr given by the user as the starting addr and tell it read on till it reaches the ending addr specified by the user?
-
just have the start and stop addresses and increment the address and output the pointers data [upon dereference]. of course, windows would complain. but in real mode you can do it.
hasafraggin shizigishin oppashigger...
This is my program (not complete yet..)
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
void main()
{
char *cp;
fstream f1;
clrscr();
f1.open("DATA.TXT",ios:ut);
*cp=0x0;
while(!kbhit())
{
f1<<*cp;
gotoxy(1,1);
clreol();
cout<<"ADDRESS : "<<cp<<"\t\t"<<"VALUE : "<<*cp;
cp=cp+1;
}
f1.close();
getch();
}
Is this OK ??
-
...
...
...
...
anybody ??
-
With the additions, it is doing what you want. However, maybe what you want it to do will not be the best way.
It will crash, because Windows will not let you read some regions of memory. Also, your program gets it's own 2GB adress space. You will not be able to look into others processes' memory this way.
Try this:
[untested, no compiler at hand]PHP Code:
#include <stdlib.h>
#include <stdio.h>
int main()
{
const unsigned char* cp = NULL;
unsigned char c = 0;
do
{
try
{
c = *cp;
printf("Adress %p contains %x\n", cp, c );
}
catch( ... )
{
printf("Adress %p is unreadable\n", cp );
}
cp++;
}
while( !kbhit() && cp != NULL );
return 0;
}
hth
-nv
She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."
When in doubt, read the FAQ.
Then ask a smart question.
How can i assign starting addr to the char pointer and compare it with the ending addr.
DA said
>>just have the start and stop addresses and increment the address and output the pointers data [upon dereference]<<
so how to do that?
-
HA, Ive brought this post back from the dead.
Anybody...Any suggestions...
-
>>> HA, Ive brought this post back from the dead.
Yes you have, actually for the second time in this thread. Do it again and I'll delete it. Bumping threads is against the rules.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
adrian i think you might have misunderstood the
>>Anybody...Any suggestions...<< thing
i am only asking for programing help.
by the way should i post a new thread ?
-
>>>
adrian i think you might have misunderstood the
>>Anybody...Any suggestions...<< thing
<<<
I don't think so. When you post a message in reply to your own thread to promote your thread back to the top of the list, that is thread bumping, which is against the rules.
If you check the dates in the thread and the poster, you will see that this thread has been bumped twice.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.