Example: Using data transformation APIs

This example illustrates using data transformation APIs.

/*******************************************************************/
/* Sample Data Transform Program using cwbDT_Bin4ToBin4 to reverse */
/* the order of bytes in a 4-byte integer.                         */
/*******************************************************************/
 
#include <iostream.h>
#include "cwbdt.h"
 
 
void main()
{
   unsigned int returnCode;
   long source,
        target;
 
   cout << "Enter source number:\n";
 
   while (cin >> source) {
     cout << "Source in Dec = " << dec << source;
     cout << "\nSource in Hex = " << hex << source << '\n';
     if (((returnCode = cwbDT_Bin4ToBin4((char *)&target,(char *)&source)) == CWB_OK)) {
        cout << "Target in Dec = " << dec << target;
        cout << "\nTarget in Hex = " << hex << target << '\n';
     } else {
        cout << "Conversion failed, Return code = " << returnCode << '\n' ;
     }; /* endif */
     cout << "\nEnter source number:\n";
 
 
   }; /* endwhile */
 
}