>> I don't get cdf112bf cdf112bf cdf112bf cdf112bf ... 257 times
It would actually be 256 times, but anyway, what output are you getting?
>> How would I use memcpy() to replicate my array?
char* duplicate( char* buffer, size_t buffer_length, char const* pattern, size_t pattern_length )
for( char* ptr = buffer; buffer_length != 0; buffer_length -= pattern_length, ptr += pattern_length )
if( pattern_length > buffer_length )
pattern_length = buffer_length;
memcpy( ptr, pattern, pattern_length );
OK, so it wasn't really any simpler than the original code.