Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to align text in C?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I want to center a little heading that I made for the title of my program... Is there some function or something that will align text on the screen? Thanks.

 
try to use the caracter '\t'.

example: printf("\t\tHello !");
 
char *str ="prog_name";

main() {
printf("%30s\n",str);
}

will print (30 - sizeof(str)) spaces followed by the value of str i.e "prog_name".

Output
--------
Server2 ~$ ./pr
prog_name

cheers
amit
crazy_indian@lycos.com

to bug is human to debug devine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top