wstring to ostream

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

i have a simply code to write a string to an ostream:

bool CXXStreamTools::WriteString(ostream &os,string Value)
{
try
{
long len = Value.size()+1;
os.write(reinterpret_cast<char *> (&len),sizeof(len));
os.write(reinterpret_cast<char *> ((char
*)Value.c_str()),len);

}
catch(...)
{
return false;
}
return true;
}


it works fine.

How can i write (or read) a wstring instead of a string to the same
ostream ?

Do you know a good overview about this themes ?


Thanks in advance,

Howie
.



Relevant Pages

  • Re: ostream, istream, and String^
    ... > ostream% operator <<(ostream% output, String^ str) ... > istream% operator>> ...
    (microsoft.public.dotnet.languages.vc)
  • Cant understand this! (Help required please)
    ... the compiler gurgles out an ... This seems to work for int and double and even char but not for string ... where string1 is a string object is fine as far as I remember. ... hough not entirely sure I need ostream, ...
    (alt.comp.lang.learn.c-cpp)
  • xine and kaffeine jumping
    ... The playback is jerky. ... One user has audio and another does not. ... # bool, default: 0 ... # string, default: /home/carl ...
    (alt.os.linux.suse)
  • xine runs slow when watching DVDs
    ... I am trying to use xine to watch DVDs but It keeps jerking and dropping ... # bool, default: 0 ... # string, default: http://xine.sourceforge.net/skins/skins.slx ... # send event to front end if percentage of discarded frames exceed this value ...
    (Debian-User)
  • [opensuse] hal detecting pressed dvds as empty mediums
    ... on every pressed dvd I try to read I get the ... cdrom: This disc doesn't have any tracks I recognize! ... storage.cdrom.support_media_changed = true (bool) ... info.category = 'storage' (string) ...
    (SuSE)