// JP opened flex table

Click to See Complete Forum and Search --> : Sending Float values...


mvksagar
December 9th, 2007, 12:43 AM
Hi,
I worte a RPC program for client and server, After computing (which i already did)..i get a float value.Now i want this value to be sent to the client .I know how to do with integer (By passing the addreess using the pointers,but when i am doing the same here iam getting errors.Can any 1 tell how to do that please.....
for example say i have the value in result variable ;which is float....now how should i declare and send this to the client side....

MikeAThon
December 10th, 2007, 11:31 AM
Show us the code you are using, and tell us the errors you are getting.

Incidentally, when sending floats or doubles, many programmers convert the value into a string/text representation, send the text, and then at the receiving end convert back to float/double with atoi() [see below] . It always works, avoids incompatibilites in the storage of floats between the sender and receiver (IEEE-755), avoids questions of endianness, and is easier to debug since you can "see" the number in plain text.

Mike

PS: As correctly pointed out by S_M_A, in the next post, atoi() is wrong. I meant atof(). Sorry.

S_M_A
December 10th, 2007, 05:17 PM
Mike of course means atof().

//JP added flex table