How can I pad a string with spaces on the left when using printf?
For example, I want to print \"Hello\" with 40 spaces preceding it.
Also, the string I want
I use this function to indent my output (for example to print a tree structure). The indent is the number of spaces before the string.
indent
void print_with_indent(int indent, char * string) { printf("%*s%s", indent, "", string); }