Hi, I want to append the TTime function to Append function but it cant be done as Append appends only desc(8/16), so some one please suggest me how to convert TTime to TChar/TDesc. Thanx in advance
So after using the above code, if the current time is: 2006-02-23 04:36:30 AM, then the output shoud be like this: 20060122:043630.515000. Please check the SDK documentation for TTime for more reference.
SDK says:
Quote
TTime(const TDesC& aString);
Description
Constructs a TTime object with a text string. The string consists of up to three components, any or all of which may be omitted: —
year, month and day, followed by a colon
hour, minute and second, followed by a dot
microsecond
When all three components are present, the string should take the form:
YYYYMMDD:HHMMSS.MMMMMM
The conversion from text to time is carried out in the same manner as that used in TTime::Set(). For a more complete description of how the string may be composed, see the description of TTime::Set().
Note:
A panic will occur if the string is syntactically incorrect, for example if neither a colon nor a dot is present, or if any component of the date or time is assigned an invalid value. For a list of the range of valid values for date and time components, see TDateTime::Set().
Hi, Thanx for the help, but its like i have already implemented the APIs that u told me.I have checked my code with ur suggested code it seems similar but i am unable to sort out the problem. Like in my code i am using CAknTimeOrDateSettingItem, formatL functions
I have a dout in formatL function. Is the syntax correct? TTime jdate TBuf<32> date _LIT(KDate,%d%m%y); jdate.FormatL(date,KDate)
Writing so In the epoc i am able visulize the date string but unable to read the date string in my pc when i send the date string through socket connection.
Note that in Symbian the string is unicode (18 bits per char), in PC you might be using ascii (ascii). Maybe this is why the date on PC side is not shown. Use wchar_t/wstring on PC side.
Hi, My code that is converting TTime to TChar is working fine but i have one more problem in it: Its like , I modify the date at run time and send it to my PC,at that time its first taking the current datenot the modified date,then later when i am sending it for the next time then the previous modified date is being appended.
Can someone please tell me how to modify this error,like how should i refresh the buffer containing date at runtime dynamically. Thanx in advance.
Forum posts: 732
TBuf<30> bufTime;
TTime time;
time.HomeTime();
TDateTime datetime = time.DateTime();
bufTime.Format( KFormatDate, datetime.Year(),
datetime.Month(), datetime.Day(),
datetime.Hour(), datetime.Minute(),
datetime.Second(), datetime.MicroSecond());
So after using the above code, if the current time is: 2006-02-23 04:36:30 AM, then the output shoud be like this: 20060122:043630.515000. Please check the SDK documentation for TTime for more reference.
SDK says:
Description
Constructs a TTime object with a text string. The string consists of up to three components, any or all of which may be omitted: —
year, month and day, followed by a colon
hour, minute and second, followed by a dot
microsecond
When all three components are present, the string should take the form:
YYYYMMDD:HHMMSS.MMMMMM
The conversion from text to time is carried out in the same manner as that used in TTime::Set(). For a more complete description of how the string may be composed, see the description of TTime::Set().
Note:
A panic will occur if the string is syntactically incorrect, for example if neither a colon nor a dot is present, or if any component of the date or time is assigned an invalid value. For a list of the range of valid values for date and time components, see TDateTime::Set().
Forum posts: 15
TTime ttime( _L("20060120:") );
TBuf<100> buf;
buf.Format( _L("Date: %02d Month: %02d Year: %d"), ttime.DateTime().Day() + 1, ttime.DateTime().Month() + 1, ttime.DateTime().Year() );
best regards
Ronald Stevanus
best regards,
Ronald Stevanus
Forum posts: 18
Thanx for the help, but its like i have already implemented the APIs that u told me.I have checked my code with ur suggested code it seems similar but i am unable to sort out the problem.
Like in my code i am using CAknTimeOrDateSettingItem,
formatL functions
I have a dout in formatL function.
Is the syntax correct?
TTime jdate
TBuf<32> date
_LIT(KDate,%d%m%y);
jdate.FormatL(date,KDate)
Writing so In the epoc i am able visulize the date string but unable to read the date string in my pc when i send the date string through socket connection.
Forum posts: 672
Forum posts: 8
Can any one tell me how to convert TChar to TDesC?
Waiting ..
Thanks
Forum posts: 25
try this snippet:
HBufC* buf = HBufC::NewLC( 1 );
TPtr ptr = buf->Des();
ptr.Append( chr );
// some buf handling code
CleanupStack::PopAndDestroy( buf );
// Stanislav
Forum posts: 8
staskray.
Thanks first of all for reply.
Your sample code is working fine now...
Could plz tell me::
/////////////////////////////////////////////
HBufC8* buffer = HBufC8::NewL(member>UncompressedSize());
TPtr8 bufferPtr(buffer->Des());
User::LeaveIfError(stream->Read(bufferPtr, member->UncompressedSize()));
TFileName fileName;
fileName.Append(_L("c:\\"));
fileName.Append(member->Name());
/////////////////////////////
///I Done like
fileName.Append(*bufferptr);
/////////////////////////////////
but not working........
here (member->Name()) is TBuf type
how can i pass it as TChar...
Thanks A Lot in Advance.........
Forum posts: 8
After that i tried
following which works fine at compile but gives me error at runtime??
//////////////////////////////////////
TBuf <12> fin;
fin.Copy((*member->Name()));
TChar chr=fin[0];
fileName.Append(chr);
///////////////////////////////////////////
linking error
DIALOGAPPUI.obj : error LNK2001: unresolved external symbol "public: unsigned short const & __thiscall TDesC16::AtC(int)const " (?AtC@TDesC16@@QBEABGH@Z)
//////////////////////////////////
tell me plz i am wrong
thanks a lot
Forum posts: 78
Forum posts: 18
My code that is converting TTime to TChar is working fine but i have one more problem in it:
Its like ,
I modify the date at run time and send it to my PC,at that time its first taking the current datenot the modified date,then later when i am sending it for the next time then the previous modified date is being appended.
Can someone please tell me how to modify this error,like how should i refresh the buffer containing date at runtime dynamically.
Thanx in advance.
Forum posts: 8
Thanks girish for reply
but i have included all the library
i think this error is beco.. of some coding conversion......
could you tell me the right way to convert Tbuf to Tchar