On Wed, Jun 10, 2009 at 3:38 PM, Kent Belan<[email protected]> wrote: > Hello, > I need help with a Formula. > > I have a message of variable length and need to calculate the message > header. > > Here is the formula: > The message header length is two bytes, binary, big-endian (high-order byte > first)
Try this: cMessage = do_my_stuff() nLen = LEN(cMessage) nHighByte = INT(BITAND(nLen, 0xFF00) / 256) nLowByte = BITAND(nLen, 0x00FF) cHeader = CHR(nHighByte) + CHR(nLowByte) ** I guess you need to end up with this: cNewMessage = cHeader + cMessage I don't think CTOBIN() as Tracy suggested supports big-endian. I wish fox had a BitShift() function... -- Paul _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

