strcat(cc,"\015"); index=strlen(cc); memset(&cmd,0,sizeof(cmd)); memcpy(&cmd,&index,sizeof(int)); memcpy((cmd+4),&cc,index);