- 论坛徽章:
- 0
|
20可用积分
其实就是刚才的帖子的延伸的问题:
刚才的帖子:
http://bbs3.chinaunix.net/thread-1494360-1-1.html
---------------
#include <stdio.h>
#include <stdlib.h>
#include "atmi.h"
main(argc, argv)
{
long reqlen=1024;
char *reqbuf;
/* create connection to server side of tuxedo */
if(tpinit((TPINIT *)NULL)==-1)
{
(void)fprintf(stderr, "Tpinit failed!\n");
exit(1);
}
/* allocate buffer of send */
reqbuf=(char *)tpalloc("STRING", NULL, reqlen);
if(reqbuf==(char *)NULL)
{
printf("tpalloc failed!\n");
tpterm();
}
strcpy(reqbuf, "7844");------我怎么获得用户的键盘输入?而不是这样写死呢?
/* call service TEST1 */
if(tpcall("TEST1", (char *)reqbuf, 0L, (char **)&reqbuf, (long *)&reqlen, 0)<0)
{
printf("tpcall failed, tperrno=%ld, tperrtext=%s\n", tperrno, tpstrerror(tperrno));
tpfree(reqbuf);
tpterm();
exit(1);
}
printf("name=%s\n", reqbuf);
tpfree(reqbuf);
tpterm();
return (0);
}
==============
我用以上这个c程序作客户端,去调用Tuxedo的服务TEST1,
[ 本帖最后由 simhare 于 2009-6-30 14:56 编辑 ] |
最佳答案
查看完整内容
把strcpy(reqbuf, "7844");改为scanf("%s", buf);strcpy(reqbuf, buf);buf的定义是char buf;
|