Hi,
I am running into a strange problem trying to transcode a XalanDOMString into a C-style character array. The program keeps seg faulting when I try to delete the CharVectorType object returned by the XalanDOMString::transcode() function. Here is the code for my function.
void ConvertDOMStringToCharArray( const XalanDOMString &string,
char *ch_array, int array_len )
{
/* Transcode the DOM String to a char vector */
CharVectorType *vector = new CharVectorType( string.transcode() );
if( vector == NULL )
return; /* Grab the size of the element name, truncating it if necessary */
int size = vector->size();
if( size > array_len )
size = array_len; /* Pull out the chars */
char *ch_ptr = ch_array;
for( int index = 0; index < size; index++ )
{
*ch_ptr = vector->at( index );
ch_ptr++;
}/* Ensure the char array is NULL terminated */ ch_array[ array_len - 1 ] = NULL;
delete vector; <----- Seg Faults on this line }
I am running this on Windows 2000, with SP 2, version 5.00.2195
Has anyone else ran into problems like this? Any and all help is appreciated.
--Ryan
