Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 3 months ago.
How to get ASCII null?
Hi,
How can I get an ASCII null character in the mbed compiler? Currently, in MAC, by typing %00 I can achieve a NUL character. However, when I try the same methodology in mbed compiler [by typing "%00"] I do not achieve the right results.
Is there a way to achieve the right ASCII Null?
3 Answers
9 years, 3 months ago.
you can use
pc.putc(0x00);
or
pc.printf("show %c", 0x00);
Thank you, However, I do need it to be in ASCII character in the compiler since the code is expecting an ascii character
posted by 20 Aug 20159 years, 3 months ago.
A variable containing zeros can be used in multiple ways, maybe a char array is what you are looking for:
unsigned char c[] = { 'A', 'B', 'C', 0, 0, 0 }; int sz = sizeof(c);
With the size sz=6 you will see that it is 6 bytes long. I would recommend to get a C/C++ Basic book to learn C/C++.