Passing Structure with Pointers Example
This section describes the procedure for passing structure with pointers example.
The following example calls the previously written xdr_simple routine as well as the built-in xdr_string and xdr_reference functions. The xdr_reference routine chases pointers.
struct finalexample {
char *string;
struct simple *simplep;
} finalexample;
xdr_finalexample(xdrsp, finalp)
XDR *xdrsp;
struct finalexample *finalp;
{
if (!xdr_string(xdrsp, &finalp->string, MAXSTRLEN))
return (0);
if (!xdr_reference(xdrsp, &finalp->simplep,
sizeof(struct simple), xdr_simple);
return (0);
return (1);
}