5
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by Sarang07
0

You could try something like below...I generally don't like the solution but it works for some situations

#include <stdio.h>
#include <stdlib.h>

#define t "     "

int main(int argc, char**argv)
{		
	fprintf(stdout, "this\tis\ta\ttest", stdout);	
	exit(EXIT_SUCCESS);
}

Edited by gerard4143: n/a

0

You could try something like below...I

That should produce an error because \' ' is not a valid escape sequence.

If you don't like the default spacing then don't use tabs. Do something like this: printf("%-20s", "Hello World"); where the text string will be left-justified in a field 20 characters wide, right-side padded with spaces.

Edited by Ancient Dragon: n/a

0

C doesn't specify tab stops, only tab characters. It's up to the program consuming those characters to interpret the character with a certain tab stop length, just like it's up to the same program to accurately print the 'Q' character. Translation: change the properties of whatever program is displaying those tabs to use a five character tab stop explicitly. Most likely this will be your shell, for command line programs that send output to stdout.

Edited by Narue: n/a

0

It does not work for me.

It is as the default. I modified it but it does not worked.

Help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.