Hi,
Sorry... I know that I maybe asking a stupid qns. But i really hope someone can tell me how to get a integer value from a buffer return by a server and store it into a integer variable so that I can use it?
Thanks for any help,
zhen :cry:
Hi,
Sorry... I know that I maybe asking a stupid qns. But i really hope someone can tell me how to get a integer value from a buffer return by a server and store it into a integer variable so that I can use it?
Thanks for any help,
zhen :cry:
Yes. Look at the TCP/IP sockets example in the Series 60 SDK (Software Development Kit).
you must use the TLex8 class.
Domi.
Thanks for all ur reply. I have read through the TLex class. But i dun quite understand and dun realli knoe how and which methods to use. The socket example only print out wat is contained in the buffer, but does not uses the TLex8 class. Does anyone have sample codes or any place to recommmend for me to refer as a guide?
Thanks a million,
zhen 😮
You also need to know how the server is encoding the integer; is it sent as text/ASCII, is it sent as binary, short or long (how many bits or bytes), signed or unsigned, etc. Do you? If not, ask whomever wrote the server code. Also, what protocol is used to send/retrieve the data (raw IP/UDP socket calls, RPC, HTTP, CORBA, etc.) & do you have the corresponding protocol implementation for your phone, too or do you need to implement, e.g., the whole HTTP stack, too?
You really haven't provided enough details to help you more.
Excuse me for asking, but did you write the code to get the data from the server yourself, or are you a[n inexperienced?] programmer trying to change [or port] somebody elses program [originally written for a different purpose or operating environment]?
That is, if you know enough to write a program that can retrieve data into a buffer from a server, you surely must have also the skills to do something with the data once you have it. 😉
Guest_zhen, here is an example :
ret = file.Open( fsSession, FileToRead, EFileRead | EFileShareAny);
if (ret != KErrNone)
return ret;
TBuf8<54> Buffer;
TInt FirstValue, SecondValue;
ret = file.Read(Buffer);
file.Close();
TLex8 lex( Buffer );
lex.Val( FirstValue );
lex.SkipSpace();
lex.Val( SecondValue );
lex.SkipSpace();
Hope this help,
Domi.
Hi,
Yes it helps, thanks alot...
regards,
Guest_zhen