copying INetAddr variable to (1)another InetAddr variable (2)RWriteStream
| Wed, 2007-08-22 05:47 | |
|
to copy INetAddr variable to another InetAddr variable TInetAddr iIpAddress; iIpAddress= aIpAddress; to copy INetAddr variable to RWriteStream I am using TInetAddr iIpAddress; Is it the right way to do these things? |
|






Forum posts: 137
d
Forum posts: 137
Forum posts: 137
I found some problem in storing and retrieving
TTime iTime;
TTimeIntervalSeconds iTimeOffset;
TTime iDate;
TInetAddr iIpAddress;
objects into stream.
I tried using
RWriteStream& aStream;
aStream<< iTime;
aStream<< iTimeOffset;
aStream<< iDate;
aStream< < iIpAddress;
Can anyone tell how to write these objects into stream????????
also TInt objects are not written into Stream with << operator-------------------
RWriteStream& aStream;
TInt iColor;
aStream<< iColor;
and I had to use
RWriteStream& aStream;
TInt iColor;
aStream.WriteInt32L(iColor);
Forum posts: 137
fOLLOWING CODE WORKS FOR STORING AND RETRIEVING InetAddr INTO Stream
InetAddr iIpAddress;
TBuf<30> bufTime;
FOR WRITING TO STREAM
-----------------------------------------
iIpAddress.Output(bufTime);
aStream<
FOR READING FROM STREAM
-------------------------------------------
aStream>>bufTime;
iIpAddress.Input(bufTime);
BUT I DID NOT GET SOLN AS FOR TTime and TTimeIntervalSeconds Objects????????
CAN ANY ONE THROW ANY LIGHT ON IT!!!!!!!!!!!!!!!!!!!!!!
Forum posts: 100
TBuf<30> bufTime;Make the size at least 39, or you will only get buffer filled with *'s, when the address happens to be IPv6 address. See
http://www.symbian.com/developer/techlib/v9.1docs/doc_source/reference/reference-cpp/N102B6/TInetAddrClass.html#%3a%3aTInetAddr%3a%3aOutput%28%29
Forum posts: 1232
Or even better, don't use the unecessary extra buffer.
Just wrap the memory of your original T-variable in a TPtr, as I suggested in your time-thread: