simpcl.c

来自「tuxede下面的编程」· C语言 代码 · 共 71 行

C
71
字号
/*	Copyright (c) 1997 BEA Systems, Inc.  	All rights reserved  	THIS IS UNPUBLISHED PROPRIETARY  	SOURCE CODE OF BEA Systems, Inc.  	The copyright notice above does not  	evidence any actual or intended  	publication of such source code.*//* #ident	"@(#) apps/simpapp/simpcl.c	$Revision: 1.1 $" */#include <stdio.h>#include "atmi.h"		/* TUXEDO  Header File */#if defined(__STDC__) || defined(__cplusplus)main(int argc, char *argv[])#elsemain(argc, argv)int argc;char *argv[];#endif{	int ret,cd;	char* buf;	long len,revent;		buf=(char*)tpalloc("STRING",NULL,1024);	if (buf==NULL)	{		printf("tpalloc: %s\n",tpstrerror(tperrno));		tpterm();		exit(-1);	}	if (cd = tpconnect("TOUPPER",NULL,0,TPSENDONLY)==-1)	{		printf("tpconnect: %s\n",tpstrerror(tperrno));		tpfree(buf);		tpterm();		exit(-1);	}	else	printf("connect sucessful\n");		strcpy(buf,"tpsend first");	if (tpsend(cd,buf,(long)strlen(buf),TPNOTIME,&revent)==-1)		printf("tpsend():failule,revent=%ld,strerr=%s\n",revent,tpstrerror(tperrno));	else		printf("send one successful:\n");	strcpy(buf,"tpsend second");	if (tpsend(cd,buf,(long)strlen(buf),TPRECVONLY,&revent)==-1)		printf("tpsend():failule,revent=%ld,strerr=%s\n",revent,tpstrerror(tperrno));	else		printf("send secend successful:\n");		if (tprecv(cd,&buf,&len,0,&revent)==-1)		printf("!!!tprecv():failule,revent=%ld,strerr=%s\n",revent,tpstrerror(tperrno));	else		fprintf(stdout, "Returned string is: %s\n", buf);		if(tpdiscon(cd)==-1)		printf("tpdiscon():%s\n",tpstrerror(tperrno));	else		printf("tpdiscon() success\n");	tpfree(buf);	tpterm();	return(0);}

⌨️ 快捷键说明

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