char *FileExt = const_cast< char*> ( path. c_str ( ) ) ;
char *FileExt = new char [ path. size ( ) + 1 ] ; std:: strcpy ( FileExt, path. c_str ( ) ) ;
> oh and by the way ive tried casting it using static_cast
static_cast doesn ' t remove qualifiers , which is a very good thing because you have to actively choose const_cast , and therefore can ' t do it by accident.