Re: problem with num_get
From: P.J. Plauger (pjp_at_dinkumware.com)
Date: 05/08/04
- Next message: David Lowndes: "Re: Hide the GridLines of a cell in CListCtrl ??"
- Previous message: Mike: "Re: VC7.1 - put debug info in .exe not .pdb"
- In reply to: Yongling Ding: "problem with num_get"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 8 May 2004 06:26:50 -0400
"Yongling Ding" <ylding@comcast.net> wrote in message
news:y4adnfY_WZmhzwHdRVn-hQ@comcast.com...
> The following code seems to stop parsing right at the first ":" so that
only
> the hour field is read. The code was compiled with msvc 7.1. Any clue?
I just tried it with V7.0 and it worked fine. My V7.1 is temporarily
damaged, from installing so many trial compilers the past few months.
But I can't see any material change in the code in get_time (in
<xloctime>). No clue.
> #include <locale>
> #include <iostream>
> #include <iterator>
> #include <sstream>
>
> int main ()
> {
> typedef std::istreambuf_iterator<char,std::char_traits<char> >
iter_type;
>
> std::locale loc;
> struct tm timeb;
> std::memset(&timeb, 0, sizeof(tm));
> std::ios_base::iostate state;
> iter_type end;
>
> const std::time_get<char,iter_type>& tg =
> std::use_facet<std::time_get<char,iter_type> >(loc);
> std::istringstream ins("06:46:32");
> iter_type begin(ins);
>
> std::cout << *tg.get_time(begin,end,ins,state,&timeb) << std::endl;
>
> std::cout << timeb.tm_hour << std::endl
> << timeb.tm_min << std::endl
> << timeb.tm_sec << std::endl;
>
> return 0;
> }
P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
- Next message: David Lowndes: "Re: Hide the GridLines of a cell in CListCtrl ??"
- Previous message: Mike: "Re: VC7.1 - put debug info in .exe not .pdb"
- In reply to: Yongling Ding: "problem with num_get"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|