LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a swap()-routine in any CVI-Lib?

Hallo NI,

 

Several years ago I have worked with MS Visiual C++ and CVI5.5. Duing this time I developed a program which used the swap()-routine out of MSVC++-lib. Now I want to redevelop this program without using MSVC++. Is there any lib which uses the swap-routine in CVI 8.5?

 

0 Kudos
Message 1 of 4
(3,215 Views)

In CVI, there is no swap command, however, the Tools library provides the SwapBlock function to swap the contents of two blocks of memory. Another possibility is to define a macro.

0 Kudos
Message 2 of 4
(3,213 Views)
I have to apologize about my misspelling! It is a swab() routine not a swap(). However, the question is the same.
0 Kudos
Message 3 of 4
(3,208 Views)

How hard can it be? Let's see...

 

 

void _swab( char *src, char *dest, int n )
{
// Assumes n is even. Add appropriate code if it may be odd.

// Also assumes src and dest are not the same

 

int indx;

for (indx=1; indx<n; indx+=2)
{
dest[indx-1] = src[indx];
dest[indx] = src[indx-1];
}
}

 

 

 

Message Edited by msaxon on 26-04-2010 09:24 AM
--
Martin
Certified CVI Developer
0 Kudos
Message 4 of 4
(3,202 Views)