Decoding function in vb.net

  • Thread starter Thread starter Valli
  • Start date Start date
V

Valli

Hi,

I am having encode & decode functions in C.
Will receive an encoded value in vb.net( this encoded value is updated in
database by another C process) & this must be decoded using vb.net code.
How can I apply this?

The decode function in C is

/*Decode function to decode the incoming buffer containing encoded data*/
void decode(char *inbuf,int sizeInbuffer,char *outbuf,int *decodeoutbufsize)
{
/*Local Declaration*/
unsigned char in[4], out[3], v;
int i, len,j;
int counter=0;
int a1=0;

for(j=0;j<sizeInbuffer;j=j+4)
{
for( len = 0, i = 0; i < 4; i++ )
{
v = 0;
while(v==0)
{
v=(unsigned char) inbuf[counter++];
v = (unsigned char) ((v < 43 || v > 122) ? 0 : cd64[ v - 43 ]);
if( v )
{
v = (unsigned char) ((v == '$') ? 0 : v - 61);
}
}
len++;
if( v )
{
in[ i ] = (unsigned char) (v - 1);
}
}

if( len )
{
decodeblock( in, out );
memcpy(outbuf+a1,out,3);
// printf("%d",strlen(outbuf));
a1+=3;
}
}

*decodeoutbufsize = a1; //Done at SetDecodedLengthForOrderMsg(). Subtract
by 2 since we have only 439 bytes, Last 1 byte also decoded with more than
one byte(i.e, two bytes).
return;
}
 
Back
Top