Hello Everybody I want to attach one String to another. The String that I want to attach is for example: {0x01,0x02,0x03,0x00,0x05} the strcat doesn't copy the bytes after 0x03 because it detects 0x00 as the NUL-Terminator I guess. its the same when I use strncat with the right length parameter. ...but I really need to handle strings like that! Who can help? Thanx a lot
If the data in your arrays has no predictable terminator value (like the null character in C strings), then you'll have to remember the length of the data. To concatenate, all you have to do is a bit of pointer arithmetic on your destination.
int memcat (U8* dst, int dstLen, U8* src, int srcLen) { return memcpy (dst + dstlen, src, srcLen); }
typedef struct { ... // various fields here } Header; Header* hdr;
typedef struct { int maxLen; int curLen; U8* data; } BoundedArray;