From: Igor Korot on
Hi, ALL,
I have following code in my program:

wxDateTime t = Now();
#if wxUSE_STD_IOSTREAM
(wxSTD ostream) stream << t.GetTicks();
#endif

The stream is based on the file on hard drive.
When I look at the file I don't see anything saved.

What is the problem? Am I using this wrong?

Thank you.


-----Original Message-----
>From: Hans Harmon <hans_harmon(a)yahoo.com>
>Sent: Mar 19, 2008 11:00 AM
>To: wx-users(a)lists.wxwidgets.org
>Subject: Re: wxDateTime (time_t) Save/Load
>
>Yes that should work.
>Typically I use typedef's for the 64 bit integers. I
>do embedded as well as desktop code. So it looks more
>like (needs endian checks):
>
>time_t now;
>
>#ifdef __HAS_INT64__
>sint64 value;
>#else
>sint32 value;
>sint32 zero;
>
>zero = 0;
>#endif
>
>value = (sint64) now;
>#ifdef __HAS_INT64__
>write ( value, sizeof ( sint64 ));
>#else
>write ( zero, sizeof ( sint32 ));
>write ( value, sizeof ( sint32 ));
>#endif
>
>
>So #if's because I am never sure of what hardware I am
>on, but the idea is the same.
>
>
>Hans
>
>--- Igor Korot <ikorot(a)earthlink.net> wrote:
>
>
>---------------------------------
>body{font-family:
>Geneva,Arial,Helvetica,sans-serif;font-size:9pt;background-color:
>#ffffff;color: black;}
>Hans,
>
>You mean something like this:
>
>
>
>time_t now;
>
>UInt 64 value;
>
>value = wxDynamicCast( now, UInt64 );
>
>if( value )
>
> // 64-bit save
>
>else
>
> // 32-bit save
>
>
>
>Thank you.
>
>
>
>-----Original Message-----
>From: Hans Harmon
>Sent: Mar 18, 2008 6:05 AM
>To: wx-users(a)lists.wxwidgets.org
>Subject: Re: wxDateTime (time_t) Save/Load
>
>time_t is changes, depending on OS and compilier.
>This makes saving it very frustrating. I had code
>that worked in MSVC 2003 only to have it break in 2005
>because time_t went from a 32 bit to 64. My
>recommendation is to cast it to 64 bit if available,
>and always write it as such. If the system does not
>have 64 bit integers then just write a blank 32 bit as
>a spacer so that it can be read in wherever you take
>the code.
>
>Hans
>
>
>Igor Korot <ikorot(a)earthlink.net> wrote:Hi, ALL,
>I just looked at the wxDataOutputStream. It has only
>Write8/16/32/64 functions.
>However, at least on MSW time_t is 'long integer'.
>
>1. Is it safe to assume time_t is 'long integer' on
>all platform?
>2. Does this mean I need to make my own function?
>
>Thank you.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail:
>wx-users-unsubscribe(a)lists.wxwidgets.org
>For additional commands, e-mail:
>wx-users-help(a)lists.wxwidgets.org
>
>
>
>
>---------------------------------
>Be a better friend, newshound, and know-it-all with
>Yahoo! Mobile. Try it
>now.---------------------------------------------------------------------To
>unsubscribe, e-mail:
>wx-users-unsubscribe(a)lists.wxwidgets.orgFor additional
>commands, e-mail: wx-users-help(a)lists.wxwidgets.org
>
>
>
> ____________________________________________________________________________________
>Looking for last minute shopping deals?
>Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
>For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
>

From: Armel on

"Igor Korot" <ikorot(a)earthlink.net> a �crit dans le message de news:
mailman.19.1208470677.17602.wx-users(a)lists.wxwidgets.org...
> Hi, ALL,
> I have following code in my program:
>
> wxDateTime t = Now();
> #if wxUSE_STD_IOSTREAM
> (wxSTD ostream) stream << t.GetTicks();
> #endif
this cast is a bit strange... from a pure C++ point of view, it means 'build
a wxSTD ostream' __value__ out of 'stream' and do '<< t.GetTicks( )' on it,
then get rid of that 'wxSTD ostream' temporary value. could it be the
problem?

> The stream is based on the file on hard drive.
> When I look at the file I don't see anything saved.
>
> What is the problem? Am I using this wrong?
>
> Thank you.
Hope it helps

Armel
>
>
> -----Original Message-----
>>From: Hans Harmon <hans_harmon(a)yahoo.com>
>>Sent: Mar 19, 2008 11:00 AM
>>To: wx-users(a)lists.wxwidgets.org
>>Subject: Re: wxDateTime (time_t) Save/Load
>>
>>Yes that should work.
>>Typically I use typedef's for the 64 bit integers. I
>>do embedded as well as desktop code. So it looks more
>>like (needs endian checks):
>>
>>time_t now;
>>
>>#ifdef __HAS_INT64__
>>sint64 value;
>>#else
>>sint32 value;
>>sint32 zero;
>>
>>zero = 0;
>>#endif
>>
>>value = (sint64) now;
>>#ifdef __HAS_INT64__
>>write ( value, sizeof ( sint64 ));
>>#else
>>write ( zero, sizeof ( sint32 ));
>>write ( value, sizeof ( sint32 ));
>>#endif
>>
>>
>>So #if's because I am never sure of what hardware I am
>>on, but the idea is the same.
>>
>>
>>Hans
>>
>>--- Igor Korot <ikorot(a)earthlink.net> wrote:
>>
>>
>>---------------------------------
>>body{font-family:
>>Geneva,Arial,Helvetica,sans-serif;font-size:9pt;background-color:
>>#ffffff;color: black;}
>>Hans,
>>
>>You mean something like this:
>>
>>
>>
>>time_t now;
>>
>>UInt 64 value;
>>
>>value = wxDynamicCast( now, UInt64 );
>>
>>if( value )
>>
>> // 64-bit save
>>
>>else
>>
>> // 32-bit save
>>
>>
>>
>>Thank you.
>>
>>
>>
>>-----Original Message-----
>>From: Hans Harmon
>>Sent: Mar 18, 2008 6:05 AM
>>To: wx-users(a)lists.wxwidgets.org
>>Subject: Re: wxDateTime (time_t) Save/Load
>>
>>time_t is changes, depending on OS and compilier.
>>This makes saving it very frustrating. I had code
>>that worked in MSVC 2003 only to have it break in 2005
>>because time_t went from a 32 bit to 64. My
>>recommendation is to cast it to 64 bit if available,
>>and always write it as such. If the system does not
>>have 64 bit integers then just write a blank 32 bit as
>>a spacer so that it can be read in wherever you take
>>the code.
>>
>>Hans
>>
>>
>>Igor Korot <ikorot(a)earthlink.net> wrote:Hi, ALL,
>>I just looked at the wxDataOutputStream. It has only
>>Write8/16/32/64 functions.
>>However, at least on MSW time_t is 'long integer'.
>>
>>1. Is it safe to assume time_t is 'long integer' on
>>all platform?
>>2. Does this mean I need to make my own function?
>>
>>Thank you.
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail:
>>wx-users-unsubscribe(a)lists.wxwidgets.org
>>For additional commands, e-mail:
>>wx-users-help(a)lists.wxwidgets.org
>>
>>
>>
>>
>>---------------------------------
>>Be a better friend, newshound, and know-it-all with
>>Yahoo! Mobile. Try it
>>now.---------------------------------------------------------------------To
>>unsubscribe, e-mail:
>>wx-users-unsubscribe(a)lists.wxwidgets.orgFor additional
>>commands, e-mail: wx-users-help(a)lists.wxwidgets.org
>>
>>
>>
>>
>> ____________________________________________________________________________________
>>Looking for last minute shopping deals?
>>Find them fast with Yahoo! Search.
>>http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
>>For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
>>
>


From: Igor Korot on
Well, I guess I owe you an apology.
There is 2 ways of doing this stuff: one through the wxFFileOutputStream and one through
the wxSTD ostream.
The thing is: the former works fine and the latter does not.
But in order to differentiate between those 2 I use the code in parenthesis..

Unless I shouldn't create a 'stream' variable with the 'wxSTD ostream' type....

Again, sorry for the confusion.

Thank you.

-----Original Message-----
>From: Armel <armelasselin(a)hotmail.com>
>Sent: Apr 19, 2008 12:24 PM
>To: wx-users(a)lists.wxwidgets.org
>Subject: Re: Strange wxGTK behavior (was Re: wxDateTime (time_t) Save/Load)
>
>
>
>
>"Igor Korot" <ikorot(a)earthlink.net> a écrit dans le message de news:
>mailman.19.1208470677.17602.wx-users(a)lists.wxwidgets.org...
>> Hi, ALL,
>> I have following code in my program:
>>
>> wxDateTime t = Now();
>> #if wxUSE_STD_IOSTREAM
>> (wxSTD ostream) stream << t.GetTicks();
>> #endif
>this cast is a bit strange... from a pure C++ point of view, it means 'build
>a wxSTD ostream' __value__ out of 'stream' and do '<< t.GetTicks( )' on it,
>then get rid of that 'wxSTD ostream' temporary value. could it be the
>problem?
>
>> The stream is based on the file on hard drive.
>> When I look at the file I don't see anything saved.
>>
>> What is the problem? Am I using this wrong?
>>
>> Thank you.
>Hope it helps
>
>Armel
>>
>>
>> -----Original Message-----
>>>From: Hans Harmon <hans_harmon(a)yahoo.com>
>>>Sent: Mar 19, 2008 11:00 AM
>>>To: wx-users(a)lists.wxwidgets.org
>>>Subject: Re: wxDateTime (time_t) Save/Load
>>>
>>>Yes that should work.
>>>Typically I use typedef's for the 64 bit integers. I
>>>do embedded as well as desktop code. So it looks more
>>>like (needs endian checks):
>>>
>>>time_t now;
>>>
>>>#ifdef __HAS_INT64__
>>>sint64 value;
>>>#else
>>>sint32 value;
>>>sint32 zero;
>>>
>>>zero = 0;
>>>#endif
>>>
>>>value = (sint64) now;
>>>#ifdef __HAS_INT64__
>>>write ( value, sizeof ( sint64 ));
>>>#else
>>>write ( zero, sizeof ( sint32 ));
>>>write ( value, sizeof ( sint32 ));
>>>#endif
>>>
>>>
>>>So #if's because I am never sure of what hardware I am
>>>on, but the idea is the same.
>>>
>>>
>>>Hans
>>>
>>>--- Igor Korot <ikorot(a)earthlink.net> wrote:
>>>
>>>
>>>---------------------------------
>>>body{font-family:
>>>Geneva,Arial,Helvetica,sans-serif;font-size:9pt;background-color:
>>>#ffffff;color: black;}
>>>Hans,
>>>
>>>You mean something like this:
>>>
>>>
>>>
>>>time_t now;
>>>
>>>UInt 64 value;
>>>
>>>value = wxDynamicCast( now, UInt64 );
>>>
>>>if( value )
>>>
>>> // 64-bit save
>>>
>>>else
>>>
>>> // 32-bit save
>>>
>>>
>>>
>>>Thank you.
>>>
>>>
>>>
>>>-----Original Message-----
>>>From: Hans Harmon
>>>Sent: Mar 18, 2008 6:05 AM
>>>To: wx-users(a)lists.wxwidgets.org
>>>Subject: Re: wxDateTime (time_t) Save/Load
>>>
>>>time_t is changes, depending on OS and compilier.
>>>This makes saving it very frustrating. I had code
>>>that worked in MSVC 2003 only to have it break in 2005
>>>because time_t went from a 32 bit to 64. My
>>>recommendation is to cast it to 64 bit if available,
>>>and always write it as such. If the system does not
>>>have 64 bit integers then just write a blank 32 bit as
>>>a spacer so that it can be read in wherever you take
>>>the code.
>>>
>>>Hans
>>>
>>>
>>>Igor Korot <ikorot(a)earthlink.net> wrote:Hi, ALL,
>>>I just looked at the wxDataOutputStream. It has only
>>>Write8/16/32/64 functions.
>>>However, at least on MSW time_t is 'long integer'.
>>>
>>>1. Is it safe to assume time_t is 'long integer' on
>>>all platform?
>>>2. Does this mean I need to make my own function?
>>>
>>>Thank you.
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail:
>>>wx-users-unsubscribe(a)lists.wxwidgets.org
>>>For additional commands, e-mail:
>>>wx-users-help(a)lists.wxwidgets.org
>>>
>>>
>>>
>>>
>>>---------------------------------
>>>Be a better friend, newshound, and know-it-all with
>>>Yahoo! Mobile. Try it
>>>now.---------------------------------------------------------------------To
>>>unsubscribe, e-mail:
>>>wx-users-unsubscribe(a)lists.wxwidgets.orgFor additional
>>>commands, e-mail: wx-users-help(a)lists.wxwidgets.org
>>>
>>>
>>>
>>>
>>> ____________________________________________________________________________________
>>>Looking for last minute shopping deals?
>>>Find them fast with Yahoo! Search.
>>>http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
>>>For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
>>>
>>
>
>
>_______________________________________________
>wx-users mailing list
>wx-users(a)lists.wxwidgets.org
>http://lists.wxwidgets.org/mailman/listinfo/wx-users