From 97a06087f7e596eb058f7b7e07b9014310be05fa Mon Sep 17 00:00:00 2001 From: Tait Hoyem <44244401+TTWNO@users.noreply.github.com> Date: Mon, 2 Dec 2019 12:03:09 -0800 Subject: [PATCH] Fix print formatting --- main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index a027163..167b089 100644 --- a/main.c +++ b/main.c @@ -4,7 +4,8 @@ int main(){ // actual program - char* print_format = {"%18s | %33s | %18s | %16s | /%2d\n"}; + char* print_format_headers = {"%18s | %31s | %18s | %16s | /%6s\n"}; + char* print_format = {"%18s | %31s | %18s | %16s | /%2d\n"}; int num_of_networks; int hosts_per_network; char file_location[255]; @@ -28,13 +29,13 @@ int main(){ fprintf(stderr, "There was an error reading the base IP address!\n"); } ui_ip = octets_to_ui(ip); - fprintf(print_file, print_format, "Network Address", "Host Range", "Broadcast Address", "Subnet Mask", 0); + fprintf(print_file, print_format_headers, "Network Address", "Host Range", "Broadcast Address", "Subnet Mask", "prefix"); for (int i = 0; i < num_of_networks; ++i){ int hosts; char subnt_s[16]; char broadcast_addr[16]; char network_addr[16]; - char usable_range[33]; + char usable_range[31]; unsigned int subnt; int this_prefix; printf("How many hosts do you need on this network [%d]? ", i);