I want to implement a text drawing function. But I am not sure how \t works, which means I don't know how many spaces I should print for \t.
I have come up with the following algorithm:
a) Each \t represents at most NUMBER_OF_SPACES_FOR_TAB spaces.
b) If \t appears in the last line at a corresponding position, \t for this line should be aligned to the \t of last line.
Example:
printf("a\t\tb\n");
printf("\t\tc\n");
Should print:
a11112222b
34444c
Where:
1.Number i represents the spaces of \t at position i
2.NUMBER_OF_SPACES_FOR_TAB == 4
Does anyone know the standard algorithm? Thanks in advance.