alexadmin Posted March 18, 2008 Report Share Posted March 18, 2008 I have integer number in the range 0..255. I want to convert it to char with respective code. For example, I can write in the C language printf("Char: %c\n",ch). In LabView (block diagram) I found block "Format Into String" which is similar to printf() function. But it does not have support of %c specifier. So, how I can perform described conversion? Thank you. Quote Link to comment
Anders Björk Posted March 18, 2008 Report Share Posted March 18, 2008 QUOTE (alexadmin @ Mar 17 2008, 03:18 PM) I have integer number in the range 0..255. I want to convert it to char with respective code. For example, I can write in the C languageprintf("Char: %c\n",ch). In LabView (block diagram) I found block "Format Into String" which is similar to printf() function. But it does not have support of %c specifier. So, how I can perform described conversion? Thank you. Under numeric and datamanipulation you have type cast. Another option is byte array to string under the string palette in combination build array. Quote Link to comment
Justin Goeres Posted March 18, 2008 Report Share Posted March 18, 2008 Here's what Anders said, in code: Note that the U8s on the front panel are the same as any other U8. I added "(as hex)" just to make it clear that they're set to display in hex. The display format doesn't change the behavior of the U8 on the block diagram. You can also use the same typecast operation with U16s, U32s, etc. and they'll be cast into multiple characters instead of just a single character as shown. EDIT: Attached the file, 'cuz well, why not? Download File:post-2992-1205766284.vi Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.