close.c

来自「分布式传输功能」· C语言 代码 · 共 87 行

C
87
字号
/*file:helloc1.c*/

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "hello.h"
#include "helloc.h"
#include <assert.h>

void main()
{
	
	RPC_STATUS status;
	unsigned char *pszUuid=NULL;
	unsigned char *pszProtocolSequence ="ncacn_np";
	unsigned char *pszNetworkAddress =NULL;
	unsigned char *pszEndpoint ="\\pipe\\hello0";
	unsigned char *pszOptions =NULL;
	unsigned char *pszStringBinding =NULL;
	unsigned char *pszString ="hello,RPC_Server!";
	short i=20;
	unsigned long ulCode;
	float num=10;
	//float balance=100; 
	// int result=2;
	

	status =RpcStringBindingCompose(pszUuid,
	                             	pszProtocolSequence,
		                            pszNetworkAddress,
									 pszEndpoint,
									 pszOptions,
									 &pszStringBinding);
	printf("%s",pszStringBinding);

	status = RpcBindingFromStringBinding(pszStringBinding,
                                         &hello_IfHandle);
	printf("RpcBindingFromStringBinding returned: 0x%x\n", status);
	 if(status)
	{
		exit(status);
	}
 
   
	 
	RpcTryExcept
	{
    	 printf("请按任意建结束");
    	getch();
    	Shutdown();

	}
	RpcExcept(1)
	{
		ulCode =RpcExceptionCode();
		printf("Runtime reported exception 0x%lx =%ld \n",ulCode,ulCode);
	//	getch();
	}
	RpcEndExcept

    

	status=RpcStringFree(&pszStringBinding);
	if(status)
	{
		exit(status);
	}
	status=RpcBindingFree(&hello_IfHandle);
	if(status)
	{
		exit(status);
	}
	exit(0);
}//end main()
//void __RPC_FAR * __RPC_API midl_user_allocate(size_t len)

void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len)
{
	return(malloc(len));
}
//void __RPC_API midl_user_free(void __RPC_FAR  *ptr)
void __RPC_USER midl_user_free( void __RPC_FAR *ptr)
{
	free(ptr);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?