I had to try it to find out . . . Too easy. ?Of course it didn¡¯t work . . . Since you have converted the input to a long_integer, you already have the 4 bytes. ?? long_integer ? li_number; integer ? byte1, byte2, byte3, byte4; ? ?? ?? ? ? byte1 = li_number & 255; ?// extract the lowest byte ? ? byte2 = (li_number}}8) & 255; //shift the number to the right by 8 bits (1 byte) and extract the next lowest byte ? ? byte3 = (li_number}}16) & 255; //etc. ? ? byte4 = (li_number}}24) & 255; //etc. ?? ? ? makestring(Output$,"ABC\\x00\\x00\\x%02X\\x%02X\\x%02X\\x%02X\r",byte4, byte3, byte2, byte1); ? From: <Crestron@...> on behalf of "Kol Johnson kol.mstc@... [Crestron]" <Crestron@...> Reply-To: <Crestron@...> Date: Wednesday, January 2, 2019 at 8:47 PM To: <Crestron@...> Subject: Re: [Crestron] Re: Simpl + String Building ?
So, have you tried dumping the long integer straight into makestring using %lx or maybe %4lx? something like ?? MakeString(Output$, "ABC\x00\x00%4lx\x0D", number); From: <Crestron@...> on behalf of "nomorefloydsound@... [Crestron]" <Crestron@...> R eply-To: <Crestron@...> Date: Wednesday, January 2, 2019 at 12:35 PM To: <Crestron@...> Subject: [Crestron] Re: Simpl + String Building ?
Thank you for reply, Dustin... The string coming in "10B0B" was already the hex equivalent of my converted long integer.? So it came in 68363 as a string, I converted it to a LONG INTEGER and then took the value of the LONG INTEGER and converted it to HEX using LToHex. which gave me 10B0B. So, I then made the string... Byte3 = MID(CodeInHex, 1, 1); Byte2 =
MID(CodeInHex, 2, 2); Byte1 = MID(CodeInHex, 4, 2); MakeString(Output$, "ABC\x00\x00\\x0%1s\\x%2s\\x%2s\x0D", Byte3, Byte2, Byte1); The Output$ string, when brought into SIMPL windows, shows EXACTLY what I need, but, when I try and send that code out of a PUSH statement it doesn't format it correctly. PUSH Press
{?? ? ?String rString[50];?rString = TestModule.SendToDest(Output$); ?Print("Server Response = %s\n",rString); ?Server_Response = rString; } |