I dont't understand UNICODE issues...

Discussion in 'C++' started by anern, Jun 13, 2011.

  1. anern

    anern Guest

    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.
    anern, Jun 13, 2011
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Goldin

    Dont understand why this does not work

    Mark Goldin, Sep 7, 2004, in forum: ASP .Net
    Replies:
    11
    Views:
    565
    Greg Burns
    Sep 8, 2004
  2. Harri
    Replies:
    2
    Views:
    480
    Ryan Stewart
    Dec 24, 2004
  3. Alexandre
    Replies:
    4
    Views:
    468
    Lasse Reichstein Nielsen
    Apr 12, 2005
  4. Simon Mansfield
    Replies:
    10
    Views:
    571
    rossum
    Dec 16, 2004
  5. Replies:
    10
    Views:
    564
    Victor Bazarov
    Jul 12, 2006
Loading...

Share This Page