LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting ViInt32 array to a ViChar array

Hi I am trying to convert an ViInt32 array to a ViChar array string.  The pulse pattern generator that we used previously went obsolete, and the replacement uses a different way of downloading the pattern into memory.

 

This is what I have:

 

ViInt32 data_buffer [16384];  // A buffer that contains 16384 of 1's and 0's. i.e. [1,1,1,1,0,0,0,0.....] This pattern is built using multiple loops.

 

The new device wants it to be a ViChar[ ]. // For example, [11110000.......]

 

 

Is there any way to easily convert my integer array of 16384 1's and 0's into a character string?

 

Thanks!

0 Kudos
Message 1 of 2
(3,943 Views)

ViChar should behave like a normal string, that is you should be able to do something like this:

 

ViInt32  a[16384];
ViChar   b[16384];
int         i;
 
for (i = 0; i < 16384; i++) {
   b[i] = 48 + a[i];
}

 The output is a chan of characters "0" and "1" mirroring the content of the int array.

 


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(3,934 Views)