For the serialization storage and reading methods of tTime, find the answer:
WhenProgramThere are many configuration file data items, and most data types are usually saved in binary format. rreadstream and rwritestream provide multiple input and output methods for numeric and descriptor types, however, you have to deal with other basic types. For example, tTime and Symbian systems use a 64-bit integer to save the date and time, in this way, when the serialized ttimer object is used, the 64-bit value can be taken out and saved. However, we will find that rreadstream and rwritestream do not provide a 64-bit integer input/output method at all, in this case, we need to split the 64-bit integer into two 32-bit integer values and save them.CodeDemonstrate how to serialize A tTime object and demonstrate different processing methods on series 2nd and 3rd platforms:
Void externalizel (rwritestream & astream)
{
TTime time;
Time. hometime ();
// Decomposes tTime object into two tuint32 objects.
Tuint32 low (0), high (0 );
# If defined _ series60_3x __
Low = i64low (time. int64 ());
High = i64high (time. int64 ());
# Else
Low = time. int64 (). Low ();
High = time. int64 (). High ();
# Endif
Astream. writeuint32l (low );
Astream. writeuint32l (high );
}
Void internalizel (rreadstream & astream)
{
// Two tuint32 objects combine to a tint64 object for constructing a tTime object.
Tuint32 low (0), high (0 );
Low = astream. readuint32l ();
High = astream. readuint32l ();
Tint64 timeval (0 );
# If defined _ series60_3x __
Timeval = make_tint64 (high, low );
# Else
Timeval = tint64 (high, low );
# Endif
TTime time = timeval;
}
Http://wiki.forum.nokia.com/index.ph...AF%B9%E8%B1%A1 Original: http://www.forum.nokia.com/forum/showthread.php? T = 139168