Hello,
I am writing a program on si. I want to transfer the following sequence of bytes to the uart: "0x1F 0x10 0x00 0x01 0x00 0x01". Because There is no byte type in C, I use char.
The program looks something like this:
char str[6]= {31, 16, 0, 1, 0, 1 }; printf("%s\n", str); The problem is that I output this sequence to the terminal of the serial port and it outputs only 0x1F 0x10, because '0' is the end of line character, so he thinks that the line ends and cuts off the rest.
Can you please tell whether it is possible to output the entire line with zero to the terminal together, i.e. so that zero is not the end of the line?
I use the termite terminal.
Thank you all for the answers.
The problem was solved with the use of not an array of char characters but an array with type uint8_t (analogous to byte in C ), which is located in the library stdint.h . Program Code:
#include <stdint.h> uint8_t str[6] = {0x1F, 0x10, 0x00, 0x01, 0x00, 0x01}; fwrite(str,sizeof(str),1,stdout); Thank you very much, gbg , for your help.
uint8_tis atypedef unsigned char uint8_t. your KO - Yaroslav