LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting functions

Hi
I want to convert an integer array into a string with each byte interleaved by a 'space'. How do I do this with Fmt or Scan function,
The length of the integer array will be  a variable one and so in the formatting functions( Fmt and Scan) it should be of arguement type.I read in the help file that , the length of the array can be mentioned as arguement by using astrisk(*) in the Fmt or Scan function. Please tell me with some example
 
Thanks
 
0 Kudos
Message 1 of 2
(2,915 Views)
If the length varies, you will have to use variables in your format strings.

This will give you a string of integers separated by spaces with a trailing space after the last value ("1 2 3 "):
Fmt( TargetString, "%s<%*d[j1] ", arrayLength, dataArray );


This will give you a string of integers separated by spaces with no trailing space after the last value ("1 2 3"):
Fmt( TargetString, "%s<%*d[j1] %d", arrayLength - 1, dataArray, dataArray[arrayLength] );

----
I am the founder of CnCSoftwareSolutions. When not cleaning up baby drool, I write about test data or work on Vision, a tool for understanding your test data. Visit me at www.cncsoftwaresolutions.com
0 Kudos
Message 2 of 2
(2,909 Views)