Reputation: 2275
How can I make sure not to happen like this? Is there any way to show exact place by numbers?
Name UID GID Dir Host
root 0 0 /root
paingpyi 500 500 /home/paingpyi 192.168.12.1
paingpyi 500 500 /home/paingpyi 192.168.12.1
Code is
printf("Name \t\tUID \tGID \tDir \tHost\n");
printf("%s \t\t%d \t%d \t%s \t%s \n",up->ut_user,pw->pw_uid,pw->pw_gid,pw->pw_dir,up->ut_host);
Upvotes: 1
Views: 71
Reputation: 76755
The printf
width specifiers are more appropriate for this kind of tasks than \t
. You should have a look into the 'field width' section of the manual.
Upvotes: 4