Mercurial > hg > Members > kono > Cerium
view old/tmp/test.c @ 880:f4bdf2b0d7da
[Renderer/Test/aquarium] sync aquarium (1 bug)
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 06 Jul 2010 23:37:11 +0900 |
parents | 529188ae604d |
children |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #define FALSE 0 #define TRUE 1 typedef int bool_t; typedef int enum_t; #include <rpc/xdr.h> #define CHUNK 1024 int main() { XDR xdrs1, xdrs2; double dp[6]; int size = CHUNK; unsigned char *addr = (unsigned char*)malloc(size); int i; double d = 0.1; xdrmem_create(&xdrs1, addr, size, XDR_ENCODE); printf("--send side--\n"); for (i = 0; i < 6; i++) { dp[i] = d * i; xdr_double(&xdrs1, &dp[i]); } int pos = xdr_getpos(&xdrs1); printf("xdr written %d\n",pos); for (i = 0; i < pos; i++) { printf("%02x", addr[i]); } printf("\n"); for (i = 0; i< 6; i++) dp[i] = 0.0; xdrmem_create(&xdrs2, addr, size, XDR_DECODE); printf("--recieve side--\n"); for (i = 0; i< 6; i++) { xdr_double(&xdrs2, &dp[i]); printf("%g\n", dp[i]); } free(addr); return 0; }