I have tried using maxchar values of up to 100 and  I still get a
segmentation fault......  

If it's any help here is what the data (the board_id) is: 

As viewed in a file in Hex:   0100F120
As displayed on the screen after being read from the file:  552665089 (this
is the result of doing a cout of the data)....

Fran


Lucian Cosoi wrote:
> 
> 2009/1/14 frano wrote:
> 
>>
>> I have the following code:
>>
>> struct unit_struct {
>>    unsigend char *version[LEN];
>>    ULONG board_id;
>>    unsigned char *unit[LEN];
>> };
>>
>>
>> const unsigned long ud_brd_id = units_data->board_id;
>> XMLCh brd_id[100];
>> XMLSize_t maxchars = sizeof(units_data->board_id);
>> const unsigned int rad = 10;
>> try {
>>    XMLString::binToText(ud_brd_id, brd_id, maxchars, rad);
>> } catch (const XMLException& exc) {
>>    cout << " Got exception \n";
>>    char *exc_msg = XMLString::transcode(exc.getMessage());
>>    cout << "Exception msg is " << exc_msg << "\n";
>> }
>>
>>
>> When the code is executed I get a segmentation fault on the
>> XMLString::binToText call......
>>
>> Any ideas of what I am doing wrong ?
>>
>> Fran
>>
> 
> You specify to the "binToText" function that the maximum number of
> characters the resulting string should be represented on is sizeof(ULONG)
> -
> which I assume is 4 or whatever number of bytes your system represents
> unsigned long on.
> 
> I guess the number stored in "board_id" is represented on more digits than
> that, and it doesn't fit.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-using-binToText-for-Long-data-tp21465842p21477049.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.

Reply via email to