Mercurial > hg > Game > Cerium
view old/tmp/test.c @ 595:2f138c672969 draft
add xdr test routine...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 04 Nov 2009 22:27:22 +0900 |
parents | |
children | f1c2e11a2ef4 |
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 xdrs; double dp[6]; int size = CHUNK; char *addr = (char*)malloc(size); int i; double d = 0.1; xdrmem_create(&xdrs, addr, size, XDR_ENCODE); for (i = 0; i< 6; i++) { dp[i] = d * i; xdr_double(&xdrs, &dp[i]); } for (i = 0; i< 6; i++) dp[i] = 0.0; xdrmem_create(&xdrs, addr, size, XDR_DECODE); for (i = 0; i< 6; i++) { xdr_double(&xdrs, &dp[i]); printf("%g ",dp[i]); } printf("\n"); }