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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Algorithm to print out "memory addresses" 2

Status
Not open for further replies.

JGSH

Programmer
Feb 23, 2003
6
US
Hi,

I need help on an algorithm that will help me print out memory addresses per line.
It will be up to 7 hex digits.
So it will basically print out...

0000000
0000010
0000020
etc
00000f0
0000100
all the way to
fffffff

thanks,
Jon
 
by default

cout<<ptr<<endl;

should print out in hex. There is always sprintf where you write the memory address into a character buffer

sprintf(buffer,&quot;%08x&quot;,ptr);
cout<<buffer<<endl;

Is that what you are looking for?

Matt
 
Something like this might work.

[tt]#include <stdio.h>

int main()
{
int i;
for (i = 0; i < 0xfffffff; i++)
printf(&quot;%08x\r\n&quot;, i);
return 0;
}[/tt] //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top