您好,多上下文是什么意思呢?
我代码基本就是这样
if (tpinit((TPINIT *) NULL) == -1)
{
printf("tpinit Error!\ntperrno=%d tperrmsg=%s\n",tperrno, tpstrerror(tperrno)); // 系统错误
userlog("tpinit Error!\ntperrno=%d tperrmsg=%s\n",tperrno, tpstrerror(tperrno));
fclose(fp);
return retFailInfo;
}
sendbuf=(FBFR32 *) tpalloc("FML32",NULL,lSendLen+1); // 申请FML32缓冲区10k
if(sendbuf==NULL)
{
printf("tpalloc send buffer error!\ntperrno=%d tperrmsg=%s\n",tperrno, tpstrerror(tperrno)); // 系统错误
userlog("tpalloc send buffer error!\ntperrno=%d tperrmsg=%s\n",tperrno, tpstrerror(tperrno));
fclose(fp);
tpterm();
return retFailInfo;
}
rcvbuf=(FBFR32 *) tpalloc("FML32",NULL,lRcvLen+1); // 申请FML32缓冲区20k
if(rcvbuf==NULL)
{
printf("tpalloc rev buffer error!\ntperrno=%d tperrmsg=%s\n",tperrno, tpstrerror(tperrno)); // 系统错误
userlog("tpalloc rev buffer error!\ntperrno=%d tperrmsg=%s\n",tperrno, tpstrerror(tperrno));
fclose(fp);
tpfree((char *)sendbuf);
tpterm();
return retFailInfo;
}
//给FML32缓冲赋值
//if(strcmp(strAreaCode,"null")!=0)
Fchg32(sendbuf,AREA_CODE,0,strAreaCode,0);
//if(strcmp(strAccNbr,"null")!=0)
Fchg32(sendbuf,ACC_NBR,0,strAccNbr,0);
//if(strcmp(strAcctNbr,"null")!=0)
Fchg32(sendbuf,ACCT_NBR_97,0,strAcctNbr,0);
//if(lStaffId != -1)
Fchg32(sendbuf,STAFF_ID,0,(char *)&lStaffId,0);
//if(lGetFlag != -1)
Fchg32(sendbuf,GET_FLAG,0,(char *)&lGetFlag,0);
//if(lAdslFlag != -1)
Fchg32(sendbuf,ADSL_FLAG,0,(char *)&lAdslFlag,0);
//if(strcmp(strExchNo,"null")!=0)
Fchg32(sendbuf,EXCH_NO,0,strExchNo,0);
Fchg32(sendbuf, CHANNEL_ID, 0, strChannel_Id, 0);
Fchg32(sendbuf, ENCODE, 0, strEncode, 0);
#ifdef DEBUG
printf("Send fields in calling GET_BY_NBR_IN:\n");
Fprint32(sendbuf);
//调用查询欠费服务
SCFERROR("invoke tpcall()");
#endif
sprintf(strSendbuf, "%04d%02d%02d%02d%02d%02d ", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
sprintf(strSendbuf+strlen(strSendbuf), "%s send querybynbr ExchNo %s AreaCode %s AccNbr %s AcctNbr97 %s StaffId %ld GetFlag %ld AdslFlag %ld Channel_id %s Encode %s",
strInesName, strExchNo, strAreaCode, strAccNbr, strAcctNbr, lStaffId, lGetFlag, lAdslFlag, strChannel_Id, strEncode);
if(fprintf(fp, "%s\n", strSendbuf) < 0){
userlog("WARNING: writing log by send querybynbr error!\ntperrno = %d tperrmsg = %s\n", tperrno, tpstrerror(tperrno));
}
fflush(fp);
printf("tpcall now!");
ret=tpcall("GET_BY_NBR_IN",(char *)sendbuf,0,(char **)&rcvbuf,&lRcvLen,(long)0);
如何检验您说的上下文问题呢?