Angus wrote:
"Victor Bazarov" <v.********@com Acast.netwrote in message
news:en******** **@news.datemas .de...
>Angus wrote:
>>I need to port some Java code and am wondering if there is a close
equivalent to ByteArrayOutput Stream.
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_stringst ream' with
'unsigned char' as its first argument:
std::basic_stri ngstream<unsign ed charmystream;
(if unsigned char [0..255] is the requirement, Java's 'byte' is actually
unsigned) or use std::stringstre am 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