|
Prev: @Vadim and Julian: Detailed Guide to set up MSYS, MinGW, EclipseCDT and wxWidgets on Windows
Next: wxAuiNotebook Save/Load Perspective?
From: Igor Korot on 18 Mar 2008 01:27 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
From: Hans Harmon on 19 Mar 2008 11:00
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 |