有没有函数删除一个buf的某个位置到某个位置buf={1,2,3,4} 我要删除从1-2的位置。得到的是buf={1,4}
wcg_jishuo:
改良版(BCD码的数据)
#include
#include
#include
int deletpos(int bcdlen,char *str,int istart,int iend,char *dest)
{
int i= istart-0;
int dellen= iend-istart+1;//2
if(i!=0)
{
memcpy(dest,str,i);
}
memcpy(&dest[i],&str[iend+1],bcdlen-(dellen+i));//实际是copy多少个
return 0;
}
void main()
{
char test[]={0x11,0x22,0x33,0x44,0x55};
char dest[1024]={0};
int ipos=1,iendpos=2;
//int ipos=13,iendpos=13+19;
deletpos(sizeof(test),(char*)test,ipos,iendpos,dest);
printf("test=\n",test);
for(int j=0;j |