Is there a way to replace the space character to 0 in printf padding for field width
Code used
printf(\"%010s\",\"this\");
Doesnt s
Indeed, the 0 flag only works for numeric conversions. You will have to do this by hand:
0
int print_padleftzeroes(const char *s, size_t width) { size_t n = strlen(s); if(width < n) return -1; while(width > n) { putchar('0'); width--; } fputs(s, stdout); return 0; }