02-16-2009 02:22 PM
Hello,
My UUT sends to my computer via serial port both printable and non-printable ascii characters. The question is:
1) how do I display all those characters in a text box.
2) how do I display all those characters in hex format and display in a text box?
Thank you.
Robert
Solved! Go to Solution.
02-17-2009 02:17 AM - edited 02-17-2009 02:18 AM
Textboxes actually can receive strings with both printable and non-printable characters: non-printable characters will be represented with a little square. Consider for example this code:
char a[512], msg[512];
// Create a string with embedded non-printable characters
sprintf (a, "Hello :%c%c%c%c%c: world!", 1, 2, 3, 4, 5);
// Pass the string to the textbox "as is"
ResetTextBox (bH[1], b1_n, a);
//Format a hex representation of the string and add to the textbox
Fmt (msg, "\n%*d[zb1r16w2p0j1] ", strlen (a), a);
SetCtrlVal (bH[1], b1_n, msg);
Result is as follows: the first line is the string passed "as is", the following is the hex representation.
02-17-2009 05:45 PM
Thanks for the code snippet. That helped.
Robert Mensah