Hi,
I want to return a data with the type NVARCHAR. How could I do it?
Here is my function :
Code:
II_STATUS
my_function(
II_SCB *scb,
II_DATA_VALUE *p1, /*type nvarchar*/
II_DATA_VALUE *p1, /*type nvarchar*/
II_DATA_VALUE *rdv /* return_text need nvarchar */
){
char str[400];
unsigned char this_byte1[2],this_byte2[2],byte1[40], byte2[40];
unsigned int true_length1,true_length2,iLen;
unsigned short offset;
offset=sizeof(short);
int i;
true_length1 = *(short*)p1->db_data;
true_length2 = *(short*)p2->db_data;
memset(byte1, 0, sizeof(byte1));
memset(this_byte1, 0, sizeof(this_byte1));
for (i=0; i < true_length1; i++) {
strncpy(this_byte1, (char *)(p1->db_data + offset + i*2), 2);
strcat(byte1,this_byte1);
};
memset(byte2, 0, sizeof(byte2));
memset(this_byte2, 0, sizeof(this_byte2));
for (i=0; i < true_length2; i++) {
strncpy(this_byte2, (char *)(p2->db_data + offset + i*2), 2);
strcat(byte2,this_byte2);
};
int iLen;
memset(str, 0, sizeof(str));
strcpy(str,byte1);
iLen = strlen(byte1);
memcpy(str + iLen, ".", 1);
iLen += 1;
memcpy(str + iLen ,byte2,true_length2 );
iLen += true_length2;
*(short *) rdv->db_data = iLen;
//Here, I don't know how to input the value into (char *)rdv->db_data?
strcat((char *)rdv->db_data + offset, str);
}
Could someone read it and answer my question?
Mille thx for you.
Zhao Xu