actube/src/cw/bstr16_create.c

13 lines
216 B
C
Raw Normal View History

#include "bstr.h"
bstr16_t bstr16_create(const uint8_t *data, uint16_t len)
{
uint8_t * str = malloc(2+len*sizeof(uint8_t));
if (!str)
return 0;
*((uint16_t*)str)=len;
memcpy(str+2,data,len);
return str;
}