C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to get a formatted output right?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Tue Dec 19, 2006 10:11 am    Post subject: how to get a formatted output right? Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.