Get a C-Style String from a C++ String : string at « String « C++






Get a C-Style String from a C++ String

  
#include <cstdio>
#include <string> 

using namespace std; 

int main( )
{
   string boss( "B" );

   printf( "%s is an important man.\n\n", boss.c_str() ); 

   char man[50];
   strcpy( man, boss.c_str() );
   strupr( man );
   printf( "this is a test: %s\n", man );
}
  
    
  








Related examples in the same category

1.Demonstrating member function at
2.Display the characters in a string one at a time by using the indexing operator
3.Accessing Character Elements of an STL String