I dont't understand UNICODE issues...

A

anern

And now I have a new one....
I've just started using boost and I decided to change some of my code over
from using time_t stuff to using ptime stuff. I try a test project (VC2008
express):

#include "boost/date_time/gregorian/gregorian.hpp"
#include "boost/date_time/posix_time/posix_time.hpp"
#include <fstream>
using namespace std;
using namespace boost::gregorian;
using namespace boost::posix_time;

int main()
{
ptime stamp=microsec_clock::local_time();
wfstream Logfile("xxx.txt",ios::eek:ut | ios::trunc);
Logfile << stamp;
}

and it works. "Use Unicode Character Set" is used.
I put identical code into a more complex project (with clr) and I get a
debug assertion Failed (sic !)!
File: f:\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c (I've no folder
called f:\dd on my machine)
Expressions _crtisvalidheappointer(puserdata)

and I track the assertion down to a line of code in time_facet.hpp line
1511. which is :

ss << ' ' << zone_abbrev_format;

I change the line to

ss << L' ' << zone_abbrev_format;
and it works.
ss expands in the debugger to
std::basic_ostream<wchar_t,std::char_traits<wchar_t> > = {...}

There are sooooo many things I don't understand about this : Why the code
works in one place an not another, where this non-existent f:\dd folder
comes from, if I really have to use the L"xyz" and L'x' syntax for my
unicode strings and chars (cos the library doesn't). Maybe I should go back
to writing my own library code... at least I know how it works..
Help endlessly appreciated.

Bruce.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top