 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Tue Dec 19, 2006 10:11 am Post subject: how to get a formatted output right? |
|
|
Hi,
i want to get the adress of a pointer in a string. I did so by
outputting it to a ostringstream:
------------------------------
char* ptr;
//generate adress in hex format
std::ostringstream osstr,ossbyteSize ;
//This does not work anyway
//osstr.flags((std::ios_base::fmtflags)513);
//cout <<osstr.flags()<<endl;
osstr << &ptr;
std::string value = osstr.str();
cout << value<<endl;
---------------------------------
This works actually.. just the formatting is different when compiling
under Visual Studio and g++ Linux.
MSVC: 0022FFCC
Linux: 0x22ffcc
Id like to have a 8byte string containing the adress.. even if its lead
by some zeros.
Ok i said.. lets browse the net and set the formatting flags for both.
i got the flags of the windows version (513) and tried to set it for
both..(linux showed 4098).
Now linux also shows 513.. but the output is the same.
any ideas?
is this a maybe a compiler issue? could anybody reassure me that i did
the language part right? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|