- 论坛徽章:
- 0
|
把我(自己都看不顺眼)的代码贴出来 瞧瞧
send.c
#include<stdio.h>
#include<stdlib.h>
#include<rpc/rpc.h>
#include "send.h"
main(argc,argv)
int argc;
char *argv[];
{
CLIENT *cl,*clnt_create();
char *server;
struct cell *nl;
int *result;
struct cell *a,*b,*c,*d;
a=malloc(sizeof(struct cell));
b=malloc(sizeof(struct cell));
c=malloc(sizeof(struct cell));
d=malloc(sizeof(struct cell));
a->data=1;
a->left=b;
a->right=c;
b->data=2;
b->left=NULL;
b->right=d;
c->data=3;
c->left=d;
c->right=NULL;
d->data=4;
d->left=NULL;
d->right=NULL;
server=argv[1];
cl=clnt_create(server,SENDPROG,SENDVERS,"tcp");
if(cl==NULL){
clnt_pcreateerror(server);
exit(1);
}
result=send_1(&a,cl);
if(*result==0)
printf("error\n");
exit(0);
} |
|