Boost logo

Boost :

From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2008-08-18 16:37:49


Jamie Justice wrote:
> I need to convert a char array to a byte array of ASCII encoded characters to send over a TCP connection, but I can't use the CLR(and therefore the System namespace) with boost. Does anyone have a solution to this?
>
This is not very much information. What kind of char array?

Does it contain ASCII-encoded characters in the first place (i.e. is
your program only compatible with ASCII-based platforms (likely, if you
considered using C++/CLI), and there are no non-ASCII characters in your
array)? If so, your char array *is* the byte array you want.

Does it contain non-ASCII characters in some encoding? Well, then you do
you intend to get it to ASCII?

Is it really a wchar_t array containing some wide encoding? Well, the
same problem applies to non-ASCII characters. Aside from that, the
codecvt facet of the locale should be perfectly capable of doing the
conversion.

Sebastian


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk