[Mono-list] reading double type...
Auge Mike
tobe_better@hotmail.com
Thu, 16 Jan 2003 23:16:28 +0400
Hi all,
I am tring to send an array of double type from native enviroment (i.e.
C/C++) to a J# (i.e. .Net environment). Here is how i do that:
From C/C++:
char szMessage[1024];
double to_send[4] = {4,5,5,5};
.
.
.
size = ( sizeof(to_send) < sizeof(szMessage)
)?sizeof(to_send):sizeof(szMessage);
memcpy(szMessage, to_send, size );
ret = send(sClient, szMessage, size, 0);
TO J#:
server = new ServerSocket( 5150,100,InetAddress.getByNam("127.0.0.1") );
connection = server.accept();
.
.
input = connection.getInputStream();
bInput = new DataInputStream (input);
.
.
//Read only two Double
for(int k=0 ; k < 2; k++)
{
double m = bInput.readDouble();
System.out.println("=p " + m);
}
And then i got the following strange result
=p 2.05531308669959E-320
=p 2.56123630804102E-320
Why ?????
And what to do??
Thank you in advance
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail