想把id中的值依次由尾部插入buffer l_acData 中:
char l_acData[4096] = { "\0" }; char *l_FiledValue; int l_iFieldType = 0; int l_iLen = 0; int FiledId = 0; l_FiledValue = (char*)p_rPreTreatment->pGetMsg(200, l_iLen, l_iFieldType);//取出id中的值 memcpy(l_acData ,l_FiledValue,l_iLen); //接入Data buf中 l_FiledValue = (char*)p_rPreTreatment->pGetMsg(201, l_iLen1, l_iFieldType); memcpy(l_acData + l_iLen ,l_FiledValue,l_iLen1); l_FiledValue = (char*)p_rPreTreatment->pGetMsg(202, l_iLen2, l_iFieldType); memcpy(l_acData + l_iLen1 ,l_FiledValue,l_iLen2); ..... l_FiledValue = (char*)p_rPreTreatment->pGetMsg(220, l_iLen2, l_iFieldType); memcpy(l_acData + l_iLen19 ,l_FiledValue,l_iLen20);
求高手指点 怎么用循环实现
解决方案
10
你要方便写循环,l_iLen … l_iLen19 这些变量最好用数组的形式
55
可以用strcat。