In the attached C Routine, how to pass the values from DS to a C structure which has 2 variables (length, bytes[66000]).
Code: Select all
#define SQL_TEXT Latin_Text
#include "/ds/data/sqltypes_td.h"
#include <string.h>
#include <stdlib.h>
struct VARBYTE_D
{
long length;
BYTE bytes[66000];
};
void vbtovc(struct VARBYTE_D *inputvarbytes, BYTE *result, char sqlstate[6])
{
strcpy(sqlstate, "0000");
for(long idx=inputvarbytes->length-1;idx>=0;idx--)
{
BYTE b= *((BYTE *)(inputvarbytes->bytes)+ idx);
*(result+idx) = b?b:' ';
}
*(result + inputvarbytes->length) = 0x00;
return
}