Converts a constant string into a 'char *', not a 'const char *'. This method still works but has been deprecated in favor of a better solution, the use the const_cast C++ keyword, see example below.

This is especially useful for broken old C libraries which have 'char *' arguments where they should ask only for 'const char *': STL string cannot be used directly since the std::string c_str() method returns a 'const char *'.

Memory gets allocated by this function, one should therefore free, with 'delete []', the returned char * when finished with it: the caller is responsible for the returned char * deallocation, otherwise memory is leaked.
the requested 'char *'. If ever there was enough memory, the application is stopped in emergency.
 void aStupidFunction( char * name ) ;

 const string aString = "Ceylan rocks!" ;
 char * convertedString = Ceylan::getNonConstCharFrom( aString ) ;
 aStupidFunction( convertedString ) ;
 delete [] convertedString ;
 aStupidFunction( const_cast<char *>( aString.c_str() ) ) ;


Generated on Thu Jun 4 20:39:15 2009 for Ceylan by  doxygen 1.5.8