W
wjh_wy
Unregistered / Unconfirmed
GUEST, unregistred user!
typedef struct _tag_OutputParameters
{
xmsCHAR * pszJMSMessageID;
// 发送-消息ID
xmsCHAR * pszCustomMessage;
// 接收-消息内容
xmsCHAR * pszErrorString;
xmsINT nErrorCode;
} OutputParameters;
xmsVOID resetOutputParameters(OutputParameters * lpOutput)
{
lpOutput->pszJMSMessageID = (char *) calloc(SAMPLE_BUFFER_SIZE, sizeof(char));
lpOutput->pszCustomMessage = (char *) calloc(CUSTOM_MESSAGE_MAX, sizeof(char));
lpOutput->pszErrorString = (char *) calloc(SAMPLE_BUFFER_SIZE, sizeof(char));
}
xmsRC xmsMsgSend(const InputParameters * lpInput, OutputParameters * lpOutput)
{
lpOutput->pszJMSMessageID = "test";
lpOutput->nErrorCode = 2;
}
int main(int argc, char ** argv)
{
InputParameters s_input;
OutputParameters s_output;
resetInputParameters(&s_input);
resetOutputParameters(&s_output);
xmsMsgSend(&s_input, &s_output);
cout << "Output.nErrorCode: " << s_output.nErrorCode << endl;
cout << "Output.pszJMSMessageID: " << s_output.pszJMSMessageID << endl;
}
// 上面的程序有问题,s_output.nErrorCode值等于0,为什么不是2呢?
{
xmsCHAR * pszJMSMessageID;
// 发送-消息ID
xmsCHAR * pszCustomMessage;
// 接收-消息内容
xmsCHAR * pszErrorString;
xmsINT nErrorCode;
} OutputParameters;
xmsVOID resetOutputParameters(OutputParameters * lpOutput)
{
lpOutput->pszJMSMessageID = (char *) calloc(SAMPLE_BUFFER_SIZE, sizeof(char));
lpOutput->pszCustomMessage = (char *) calloc(CUSTOM_MESSAGE_MAX, sizeof(char));
lpOutput->pszErrorString = (char *) calloc(SAMPLE_BUFFER_SIZE, sizeof(char));
}
xmsRC xmsMsgSend(const InputParameters * lpInput, OutputParameters * lpOutput)
{
lpOutput->pszJMSMessageID = "test";
lpOutput->nErrorCode = 2;
}
int main(int argc, char ** argv)
{
InputParameters s_input;
OutputParameters s_output;
resetInputParameters(&s_input);
resetOutputParameters(&s_output);
xmsMsgSend(&s_input, &s_output);
cout << "Output.nErrorCode: " << s_output.nErrorCode << endl;
cout << "Output.pszJMSMessageID: " << s_output.pszJMSMessageID << endl;
}
// 上面的程序有问题,s_output.nErrorCode值等于0,为什么不是2呢?