Hi all,
I'm having some trouble understanding the behavior of std::ostringstr eam.
(I'm using Visual Studio .Net & STL port 4.5.3). I'll appreciate if someone
can give me a little explanation of this behavior and how it is possible...
Here's my code
//////////////////////////
#include <stdio.h>
#include <ostream>
void func( const char* s )
{
printf( "func: [%u], [%s]\n", s, s );
}
void main( void )
{
std::ostringstr eam stream;
stream << "Hello World";
const char* s = stream.str().c_ str();
printf( "main: [%u], [%s]\n", s, s );
func( stream.str().c_ str() );
}
////////////////////////////////
And here's my result:
main: [3290280], []
func: [3290280], [Hello World]
Thankx a lot!
Ben Thomas.
I'm having some trouble understanding the behavior of std::ostringstr eam.
(I'm using Visual Studio .Net & STL port 4.5.3). I'll appreciate if someone
can give me a little explanation of this behavior and how it is possible...
Here's my code
//////////////////////////
#include <stdio.h>
#include <ostream>
void func( const char* s )
{
printf( "func: [%u], [%s]\n", s, s );
}
void main( void )
{
std::ostringstr eam stream;
stream << "Hello World";
const char* s = stream.str().c_ str();
printf( "main: [%u], [%s]\n", s, s );
func( stream.str().c_ str() );
}
////////////////////////////////
And here's my result:
main: [3290280], []
func: [3290280], [Hello World]
Thankx a lot!
Ben Thomas.
Comment