我想将缓冲区指针和缓冲区长度传递给其他函数,然后对这些数据进行操作并打印它。但是当我尝试在函数中打印它时是不可能的。
这是我的代码的一部分:
void process(KOCTET**bufferlist,KUINT16*lenlist){
KOCTET * Buffer,*temp;
KUINT16 BufferSize=5000;
KUINT16 WritePos=0;
KUINT16 total_bytes;
Buffer=(KOCTET*)malloc(5000*sizeof(KOCTET));
total_bytes = stream.CopyIntoBuffer( Buffer, BufferSize, WritePos);
bufferlist=(KOCTET**)malloc(sizeof(KOCTET*));
bufferlist=&Buffer;
lenlist=(KUINT16*)malloc(sizeof(KUINT16));
lenlist=&total_bytes;
//Print Buffer in Hexadecimal
int z=0;
temp=Buffer;
while (z<total_bytes){
printf(" %02X",(unsigned char)*temp);
temp++;
z++;
}
printf("\n");
}
void function ()
{
KOCTET**bufferlist;
KUINT16*lenlist;
process(bufferlist,lenlist);
//Print Buffer in Hexadecimal
int z=0;
temp=*bufferlist;
while (z<(*lenlist)){
printf(" %02X",(unsigned char)*temp);
temp++;
z++;
}
printf("\n");
}
谢谢,