Original Post
I'm using std::string in my project, and I have selected "Unicode" as my character set in visual studio, which I assume means UTF-8. Now, I want to just be able to do this:
stream.write(string.data(), string.size()); But looking at documentation about string has made me uneasy, since every reference I have found states that size() is the same as length() and gives you the number of characters in the string. However, in the case of most strings containing non-ascii characters, the size of the buffer is different from the number of characters. How do I get the size of the actual buffer? If there is no way, how does one save a unicode string to a file in c++?