Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/03/08 12:17
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#159558 - Declare an initialised array
Responding to: ???'s previous message
char command[] = {0x02, 0x20, 0x2E, 0x2E, 0x0D }; // no NUL terminator
char *command = "\0x02 ..\r"; // NUL terminated string


You could even just use the series of hex escapes within quotes.

Personally, I would always use the NUL terminated C string unless you are likely to have an embedded NUL in your command. And of course you would probably want the command to live in the flash code memory.

David.


List of 13 messages in thread
TopicAuthorDate
Hex byte stream            01/01/70 00:00      
   Declare an initialised array            01/01/70 00:00      
      why not in code memory???            01/01/70 00:00      
   yes, if...            01/01/70 00:00      
      Initialized array            01/01/70 00:00      
         memcpy            01/01/70 00:00      
            Thanks.            01/01/70 00:00      
         You can build your array dynamically            01/01/70 00:00      
            sprintf ??            01/01/70 00:00      
               Manuals?            01/01/70 00:00      
                  Perception            01/01/70 00:00      
                     Bandwidth of facts            01/01/70 00:00      
                        You will make a good master !            01/01/70 00:00      

Back to Subject List