Re: [Quickfix-developers] Checksum problem
Brought to you by:
orenmnero
|
From: Dave L. <dav...@ma...> - 2006-07-18 14:20:58
|
Hi Sangram,
It sounds like it is complaining about the BodyLength (tag 9) rather
than the Checksum. Is it possible for you to provide an example of the
failed message?
Cheers
Dave
-----Original Message-----
From: qui...@li...
[mailto:qui...@li...] On Behalf Of
San...@ub...
Sent: 18 July 2006 14:50
To: qui...@li...
Subject: [Quickfix-developers] Checksum problem
Hi All,
I am using C++ for QuickFix application. I am having messages in string
format and constructing a fix message out of that. I am calculating the
checksum (field 10) for the message. Checksum is calculated properly for
all the messages expect the messages having field 310 or 210. Quickfix
throws exception saying
Invalid message: Expected BodyLength=xxx, Recieved BodyLength=yyy
Here is the function to generate a checksum.
char* generateCheckSum (const char* buf, long bufLen)
{
static char tmpBuf [4];
long idx;
unsigned int cks;
for (idx = 0L, cks=0; idx < bufLen; cks+=(unsigned int) buf [idx++
]);
sprintf (tmpBuf, "%03d",(unsigned int) ((cks % 256)));
return (tmpBuf);
}
Any guess/help will be appreciated.
Thanks & Regards,
Sangram
|