xdr_char() routine

Trevor Paquette paquette at cpsc.ucalgary.ca
Thu Mar 9 08:28:52 AEST 1989


I am currently writing a program that must use the xdr routines for
reading and wrinting data. I have however come across a small drawback.
One of the machines that I am proting the code to (Iris 3020) does not
have xdr_char() in it's libraries. My question then is this:

How can I emulate xdr_char() with the other xdr routines?  I have tried
the following but it core dumps in me..

xdr_char(xdrs, ch)
XDR *xdrs;
char *ch;
{
 char t[2];
 int ret;

 if(xdrs -> x_op == XDR_ENCODE)
   {
    t[0] = *ch;
    t[1] = 0;
    ret = xdr_string(xdrs, t, 1);
   }
 else
   {
    ret = xdr_string(xdrs, t, 1);
    *ch = t[0];
   }
 return(ret);
}

               Trevor Paquette/GraphicsLand, Calgary, Alberta                 
 ..uunet!{ubc-cs,utai,alberta}!calgary!paquette          ICBM:51 03 N/114 05 W
 calgary!paquette at cs.ubc.ca      Luminous beings we are, not this crude matter



More information about the Comp.sys.sun mailing list