Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Oscar Anderson的ISO8583库获取消息长度?_C_Iso8583 - Fatal编程技术网

如何使用Oscar Anderson的ISO8583库获取消息长度?

如何使用Oscar Anderson的ISO8583库获取消息长度?,c,iso8583,C,Iso8583,如何使用Oscar Anderson的C库获得isomsg的长度 假设我有这个: enter code here DL_ISO8583_HANDLER isoHandler; DL_ISO8583_MSG isoMsg; DL_UINT8 buf[MAX_DATASIZ]; DL_UINT16 bufSize; DL_ISO8583_DEFS_1987_GetHandler(&isoHandler); /* initialise ISO

如何使用Oscar Anderson的C库获得isomsg的长度 假设我有这个:

enter code here

DL_ISO8583_HANDLER isoHandler;
DL_ISO8583_MSG     isoMsg;
DL_UINT8           buf[MAX_DATASIZ];
DL_UINT16          bufSize;

DL_ISO8583_DEFS_1987_GetHandler(&isoHandler);

/* initialise ISO message */
DL_ISO8583_MSG_Init(NULL,0,&isoMsg);


(void)DL_ISO8583_MSG_SetField_Str(0,"0320",&isoMsg);
(void)DL_ISO8583_MSG_SetField_Str(2,"4401410145200145",&isoMsg); 
(void)DL_ISO8583_MSG_SetField_Str(3,"310000",&isoMsg);
(void)DL_ISO8583_MSG_SetField_Str(4,"000000001045",&isoMsg);
(void)DL_ISO8583_MSG_SetField_Str(11,"000015",&isoMsg);

(void)DL_ISO8583_MSG_Pack(&isoHandler,&isoMsg,&buf[7],&bufSize);

如何获取我的isoMsg长度?

从这里我看到的是
DL\u ISO8583\u MSG
的定义:

struct DL_ISO8583_MSG_S
{
    /* static memory details */
    DL_UINT8 *sPtrNext; /* next static point - NULL if dynamic mode  */
    DL_UINT8 *sPtrEnd;  /* end of the static buffer (if static mode) */

    /* NB bitmap is not stored, it is implied if the field is set */

    /* fields */
DL_ISO8583_MSG_FIELD field[1+kDL_ISO8583_MAX_FIELD_IDX];
};
typedef struct DL_ISO8583_MSG_S DL_ISO8583_MSG;

只需通过
DL_UINT8指针进行解析
并将计数存储到一个变量中。

sizeof(isoMsg)?它给出了一个很大的数字,而不是实际长度。您能提供结构DL_ISO8583_MSG的定义吗?struct DL_ISO8583_MSG{/*静态内存详细信息/DL_UINT8*sPtrNext;/next static point-NULL(如果动态模式)/DL_UINT8*sPtrEnd;/end of the static buffer(如果静态模式)//NB bitmap未存储,如果设置了字段,则表示为//fields*/DL_ISO8583_MSG_field[1+kDL_ISO8583_MAX_field_IDX]};typedef struct DL_ISO8583_MSG_S DL_ISO8583_MSG;由于我不了解代码的用法,您能对代码添加注释吗。Thx