Angus wrote:
"Victor Bazarov" <v.Abazarov@comAcast.net> wrote in message
news:enh3gj$65l$1@news.datemas.de...
Angus wrote:
I need to port some Java code and am wondering if there is a close
equivalent to ByteArrayOutputStream.
I have been looking at the STL iostream library but not quite sure
what is best to use.
Any help would be much appreciated.
Any standard stream has 'write' member that takes a pointer to char,
which is probably what you want... What problem are you solving?
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
I am working with binary data - so bytes of anything. I am looking at
stringstream but maybe it won't like embedded control characters etc.
Ah... No such thing as "embedded control characters" in C++, AFAIK.
'char' and 'unsigned char' are just integral types with value ranges.
Do you know if that is the case? If not what to use?
No, it's not the case. It seems you just need 'basic_stringstream' with
'unsigned char' as its first argument:
std::basic_stringstream<unsigned char> mystream;
(if unsigned char [0..255] is the requirement, Java's 'byte' is actually
unsigned) or use std::stringstream if 'char' is fine; you may need to
cast to unsigned char later.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.