|
Boost Users : |
Subject: Re: [Boost-users] lexical_cast<unsigned char>: Compiler error
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2009-03-06 10:58:28
On Fri, Mar 6, 2009 at 4:45 PM, Hansi <hansipet_at_[hidden]> wrote:
> Ovanes Markarian schrieb:
>
>> Hi!
>>
>> strange code... You are trying to convert a 2 byte character string into a
>> single byte unsigned character value? Std C++ does not definitely provide
>> possibility for it. But if you know how to do the conversion, overload the
>> operator >>, which accepsts the istream and unsigned char, smth. similar to:
>>
>> The code is not so strange because for me the unsigned char is not a
> character but a number...
IMO this is strange, because you cut from the number a part, which might
contain useful data and C++ prevents you from that. Why don't you convert it
to wchar_t or unsigned short? L"..." produces multi byte char string.
Regards,
Ovanes
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net