G
Guest
Hi all,
i need to read a float number in my c# client that is received from a socket
from a java server.
1. i think i found a sollution, here it is :
public float readFloat()
{
return BitConverter.ToSingle(BitConverter.GetBytes(readInt()),0);
}
it seems ok,
is it ok ? (readInt() is my method that read a 4 bytes as int from a socket
in a BigEndian order)
2. but when i use instead the BitConverter class the Convert class like this :
return Convert.ToSingle(readInt());
it doesn't work ok? what's wrong ?
Thanks.
i need to read a float number in my c# client that is received from a socket
from a java server.
1. i think i found a sollution, here it is :
public float readFloat()
{
return BitConverter.ToSingle(BitConverter.GetBytes(readInt()),0);
}
it seems ok,
is it ok ? (readInt() is my method that read a 4 bytes as int from a socket
in a BigEndian order)
2. but when i use instead the BitConverter class the Convert class like this :
return Convert.ToSingle(readInt());
it doesn't work ok? what's wrong ?
Thanks.