Name:
Anonymous
2016-03-23 21:32
#include <string.h>
static const char*
string_add(const char* first, const char* second)
{
const char* result = malloc(strlen(first) + strlen(second) + 1);
strcat(result, first);
strcat(result, second);
return result;
}
const char*
leftpad(const char* str, size_t len, char ch)
{
int i = -1;
if (ch == 0) ch = ' ';
int len = strlen(str);
while (++i < len) {
char buf[2] = { 0 };
buf[0] = ch;
str = string_add(buf, str);
}
return str;
}
Name:
Anonymous
2016-05-02 7:04
>>97And in 30 years, whatever has readily supplanted UTF-8 will say you shouldn't have used UTF-8 to begin with. Go fuck yourself.