c++


How to specify the text encoding of a file in C++ using std::stringstream [on hold]


I'm in the process of converting a C++ plugin for an old Windows application to work with a newer version. The old version uses 8 bit local codepage strings, but the new version has converted everything to use 16 bit UTF16 strings. I need to make it compile in both environments for quite a transition period.
I have a bunch of #define statements based on "#ifdef UNICODE", so I've got most of it compiling in both environments.
The tricky part is a lot of code is reading and writing existing text files, and I need to not break this. If everything in memory is std::wstring or wchar_t*, but the text files are 7-bit encoded ASCII, what is the proper way to read/write them?
Most of my experience is with the .NET environment, where byte[] and string/char[] are two different things, and you have to use encodings to convert between them, and streams only operate on byte[]. How does the C++ standard library deal with encoding issues like this?

Related Links

C++ : for loop in a switch case
leveldb log_reader.h/Reader class design consideration
My linked lists program terminated with status -1073741819 In Code blocks compiler(x0000000005)) [closed]
Why does this double mutex lock not cause deadlock?
Helper function declaration outside class?
Auto declaration of map iterator error on GCC
Finding the length of a C style char * string in c++ [duplicate]
How to draw square on the button at the center using OpenGL?
How to use pthread to write a C++ class like “boost::shared_mutex”
Undefined reference to a superclass' virtual function
How many ways can fill in HxW rooms with 2x1 tatami mats? [closed]
CMake add_subdirectory not invoking the child CMakeLists.txt
How to explicitly get linear indices from arrayfire?
cppunit throws std::bad_alloc after upgrading gcc to 5.4.0
Program compiles but I think switch is ignored.
multiplication of two integer arrays

Categories

HOME
menu
objective-c
phpunit
openerp
raster
powershell-v4.0
knn
ignite
mongoose
dfa
python-3.6
dropzone.js
64bit
opentsdb
ejb
bluetooth-lowenergy
rectangles
fluent-assertions
android-toast
affinity
border
beatbox
4d-database
flip-flop
postmates
google-cloud-vision
mikrotik
nodemon
footable
lwip
coupon
master-detail
multiple-domains
chmod
bluehost
thinktecture-ident-model
webdrivermanager-java
homescreen
nerdtree
devexpress-wpf
caliburn.micro
nsset
ranorex
http-status-code-415
evosuite
wso2-appm
nuodb
maven-resources-plugin
sceditor
machinekey
voxel
cpio
rpath
aide-ide
twebbrowser
deferred-loading
display-bugs
xlconnect
kmip
numerical-analysis
data-connections
ionic-view
httpful
pysqlite
dynamics-nav-2009
jedit
fody-propertychanged
materialized-views
jison
ttml
compiler-options
ews-managed-api
avaloq-script
comfortable-mexican-sofa
nxt-python
datacontext
sine-wave
galera
mathgl
nsurlprotocol
styledtext
countries
outlook-2003
dotfuscator
ejbql
static-array
incompatibletypeerror
web-setup-project
fibonacci-heap
language-theory
dynamic-css
urldecode
orbited
microsoft.build

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App