Reputation: 3090
Hello I use following code to print tabulated out put of my database queries
printf("+----------+------------+\n");
printf("| Col1 | Col2 |\n);
printf("+----------+------------+\n");
for(i=0;i<n;i++)
printf("|%8s|%8s|\n",str1,str2);
printf("+----------+------------+\n");
It just makes my db tables look good. But can any one suggest me a more decorative way. Can I use unicode characters to make it more appealing.
Upvotes: 3
Views: 2066
Reputation: 1328
You can use Curse (ncurses) library for this, or take a look at my project: libtprint - a simple library to print tabled data, https://github.com/wizzard/libtprint
Hope it helps !
Upvotes: 2
Reputation: 76715
Unicode does include some characters intended for this. Wikipedia has a list:
http://en.wikipedia.org/wiki/Box-drawing_character
Upvotes: 2